rinchinov / ij-dbt-plugin

intelllij Idea plugin for DBT
https://plugins.jetbrains.com/plugin/23789-dbt
GNU General Public License v3.0
12 stars 1 forks source link

CreateProcess error upon start #68

Open taherajnaFA opened 2 months ago

taherajnaFA commented 2 months ago

Describe the bug

Getting the below error after setting up the dbt plugin in intellij idea ultimate. Tried it with pycharm professional as well but with no luck.

using C:/Users/taher.ajnawala/IdeaProjects/finarkein_dbt/venv2/Scripts/python.exe
Caught an exception: Cannot run program "C:/Users/taher.ajnawala/IdeaProjects/finarkein_dbt/venv2/Scripts/python.exe" (in directory "C:\Users\taher.ajnawala\IdeaProjects\finarkein_dbt"): CreateProcess error=87, The parameter is incorrect
kotlin.Unit
com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'Cannot': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 7]

To Reproduce Steps to reproduce the behavior:

  1. Install DBT plugin
  2. Setup settings.
  3. Unable to start the plugin due to above mentioned error.

Expected behavior The plugin should be able to execute the python executable and load as expected.

Details

rinchinov commented 1 month ago

Hi!

Thanks for raising the issue. Could you please ensure that python intepreter is correctly working? Please attach the output of commands:

C:/Users/taher.ajnawala/IdeaProjects/finarkein_dbt/venv2/Scripts/python.exe --version
C:/Users/taher.ajnawala/IdeaProjects/finarkein_dbt/venv2/Scripts/python.exe -m  dbt.cli.main --version
C:/Users/taher.ajnawala/IdeaProjects/finarkein_dbt/venv2/Scripts/python.exe -m  dbt.cli.main debug
taherajnaFA commented 1 month ago

Hi @rinchinov , Thanks for the response! Pasting the output of the above commands:

(venv2) PS C:\Users\taher.ajnawala\IdeaProjects\finarkein_dbt> C:/Users/taher.ajnawala/IdeaProjects/finarkein_dbt/venv2/Scripts/python.exe --version
Python 3.12.2
(venv2) PS C:\Users\taher.ajnawala\IdeaProjects\finarkein_dbt> C:/Users/taher.ajnawala/IdeaProjects/finarkein_dbt/venv2/Scripts/python.exe -m  dbt.cli.main --version
Core:
  - installed: 1.8.0
  - latest:    1.8.0 - Up to date!

Plugins:
  - postgres:    1.8.0   - Up to date!
  - timescaledb: 1.8.0b2 - Up to date!

(venv2) PS C:\Users\taher.ajnawala\IdeaProjects\finarkein_dbt> C:/Users/taher.ajnawala/IdeaProjects/finarkein_dbt/venv2/Scripts/python.exe -m  dbt.cli.main debug
07:44:42  Running with dbt=1.8.0
07:44:42  dbt version: 1.8.0
07:44:42  python version: 3.12.2
07:44:42  python path: C:\Users\taher.ajnawala\IdeaProjects\finarkein_dbt\venv2\Scripts\python.exe
07:44:42  os info: Windows-11-10.0.22631-SP0
07:44:42  Using profiles dir at C:\Users\taher.ajnawala\IdeaProjects\finarkein_dbt
07:44:42  Using profiles.yml file at C:\Users\taher.ajnawala\IdeaProjects\finarkein_dbt\profiles.yml
07:44:42  Using dbt_project.yml file at C:\Users\taher.ajnawala\IdeaProjects\finarkein_dbt\dbt_project.yml
07:44:42  adapter type: timescaledb
07:44:42  adapter version: 1.8.0b2
07:44:42  Configuration:
07:44:42    profiles.yml file [OK found and valid]
07:44:42    dbt_project.yml file [OK found and valid]
07:44:42  Required dependencies:
07:44:42   - git [OK found]

07:44:42  Connection:
07:44:42    host: localhost
07:44:42    port: 5434
07:44:42    user: postgres
07:44:42    database: airbyte
07:44:42    schema: uat
07:44:42    connect_timeout: 10
07:44:42    role: None
07:44:42    search_path: None
07:44:42    keepalives_idle: 0
07:44:42    sslmode: None
07:44:42    sslcert: None
07:44:42    sslkey: None
07:44:42    sslrootcert: None
07:44:42    application_name: dbt
07:44:42    retries: 1
07:44:42  Registered adapter: timescaledb=1.8.0-b2
07:44:42    Connection test: [OK connection ok]

07:44:42  All checks passed!
(venv2) PS C:\Users\taher.ajnawala\IdeaProjects\finarkein_dbt>
rinchinov commented 1 month ago

hmm, it really strange

It looks like plugin is broken on windows, actually I never tested it with windows, and even have no PC with windows to debug it right now

rinchinov commented 1 month ago

Could you please remove "=" from environment variables options?

taherajnaFA commented 1 month ago

@rinchinov even when i remove the '=' and save the settings, it automatically puts it back in. When i reopen the settings, the '=' comes back again.

Also it did log a few different errors this time, just pasting it here if its any helpful

using C:/Users/taher.ajnawala/IdeaProjects/finarkein_dbt/venv2/Scripts/python.exe
using C:/Users/taher.ajnawala/IdeaProjects/finarkein_dbt/venv2/Scripts/python.exe

Traceback (most recent call last):
  File "<string>", line 7, in <module>
  File "C:\Users\taher.ajnawala\AppData\Local\Programs\Python\Python312\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\taher.ajnawala\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\taher.ajnawala\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)

Traceback (most recent call last):
  File "<string>", line 7, in <module>
  File "C:\Users\taher.ajnawala\AppData\Local\Programs\Python\Python312\Lib\json\__init__.py", line 346, in loads
    return _default_decoder.decode(s)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\taher.ajnawala\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\taher.ajnawala\AppData\Local\Programs\Python\Python312\Lib\json\decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)
com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1]
com.fasterxml.jackson.databind.exc.MismatchedInputException: No content to map due to end-of-input
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1]

image

rinchinov commented 1 month ago

Hey!

It looks like it is something windows specific(I can't reproduce it on OSX). Unfortunately, I have no windows machine to debug it properly.

I just notice that interpreter path with \ but dbt profile directory with /. Could you please try to change it to \?

taherajnaFA commented 1 month ago

@rinchinov i understand that it is difficult to pinpoint a OS related issue, appreciate the help though!

Did try it out with backward slashes as well as forward, but both didn't work. I see you pushed a commit. Assuming its a possible fix, is there a way i can test that?

rinchinov commented 1 month ago

Assuming its a possible fix, is there a way i can test that?

I am not sure that it can help, but I added more logging for failures, maybe it will help us to understand the root cause.

rinchinov commented 1 month ago

Try to use this version https://github.com/rinchinov/ij-dbt-plugin/releases/tag/v0.2.5

How to install: https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_disk

And please attach the new logs, it should add to logging all arguments that passed to executable.

UPD: It looks like I found possible root cause, and v0.2.5 will no help.

taherajnaFA commented 1 month ago

@rinchinov just in case you need it, this is what it logged:

using C:\Users\taher.ajnawala\IdeaProjects\finarkein_dbt\venv2\Scripts\python.exe
Caught an exception: Cannot run program "C:\Users\taher.ajnawala\IdeaProjects\finarkein_dbt\venv2\Scripts\python.exe" (in directory "C:\Users\taher.ajnawala\IdeaProjects\finarkein_dbt"): CreateProcess error=87, The parameter is incorrect
kotlin.Unit
C:\Users\taher.ajnawala\IdeaProjects\finarkein_dbt\venv2\Scripts\python.exe
-c
from dbt.cli.main import dbtRunnerResult, Manifest
import json
import sys
from dbt.cli.main import dbtRunner as dbtRunner

args = json.loads(sys.argv[1])
kwargs = json.loads(sys.argv[2])
if ("compile", "--inline") == args[:2]:
    with open(kwargs["target_path"], "r") as f:
        manifest = Manifest.from_dict(json.read(f))
else:
    manifest = None
dbt = dbtRunner(manifest=manifest)
res: dbtRunnerResult = dbt.invoke(args, **kwargs)
if not res.success:
    raise res.exception
print(json.dumps(res.result.to_dict()))

["parse","--partial-parse"]
{"target":"local","target_path":"C:\\Users\\taher.ajnawala\\IdeaProjects\\finarkein_dbt\\.dbt_plugin\\local","log_path":"C:\\Users\\taher.ajnawala\\IdeaProjects\\finarkein_dbt\\.dbt_plugin\\local","profiles_dir":"C:\\Users\\taher.ajnawala\\IdeaProjects\\finarkein_dbt"}
:
com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'Cannot': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 7]

It tried this several times over and over, attaching the entire log file for reference: dbt-plugin.log