Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 3) #774

Open
maresb opened this issue Feb 13, 2025 · 2 comments
Open

json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 3) #774

maresb opened this issue Feb 13, 2025 · 2 comments

Comments

@maresb
Copy link
Contributor

maresb commented Feb 13, 2025

When running conda-lock in a GitHub action, you may see the following stack trace:

Traceback (most recent call last):
  File "/home/runner/work/conda-lock/conda-lock/conda_lock/conda_solver.py", line 388, in solve_specs_for_arch
    dryrun_install: DryRunInstall = json.loads(extract_json_object(proc.stdout))
  File "/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/opt/hostedtoolcache/Python/3.9.21/x64/lib/python3.9/json/decoder.py", line 340, in decode
    raise JSONDecodeError("Extra data", s, end)
json.decoder.JSONDecodeError: Extra data: line 2 column 1 (char 3)

This is caused by an upstream issue in conda. To mitigate, see conda/conda#14569 (comment).

Another mitigation is to add the --micromamba flag with conda-lock in order to avoid the use of conda.

@basnijholt
Copy link
Contributor

basnijholt commented Feb 25, 2025

This issue happens for me using setup-micromamba so Conda is not even involved. Therefore I am not sure whether the explanation in conda/conda#14569 (comment) applies.

Perhaps it would be the ensure-conda that is used, which uses the broken conda version?

The --micromamba worked on CI but somehow didn't work locally.

@basnijholt
Copy link
Contributor

basnijholt commented Feb 25, 2025

FWIW, I was using

      - uses: mamba-org/setup-micromamba@v2
        with:
          environment-name: conda-lock-env
          create-args: unidep conda-lock conda-package-handling

which resulted in the error json.decoder.JSONDecodeError when running conda-lock (via unidep), after pinning micromamba and explicitly adding conda as a dependency, the error resolved.

Fixed:

      - uses: mamba-org/setup-micromamba@v2
        with:
          environment-name: conda-lock-env
          create-args: unidep conda-lock conda-package-handling conda
          micromamba-version: '1.5.12-0'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants