question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failing in pipeline without input specified

See original GitHub issue

When running the command in gitlab-ci I got the following output:

cyclonedx-bom --pip --format json -o bom.json
Traceback (most recent call last):
  File "/usr/local/bin/cyclonedx-bom", line 8, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.10/site-packages/cyclonedx_py/client.py", line 259, in main
    CycloneDxCmd(args).execute()
  File "/usr/local/lib/python3.10/site-packages/cyclonedx_py/client.py", line 113, in execute
    output = self.get_output()
  File "/usr/local/lib/python3.10/site-packages/cyclonedx_py/client.py", line 63, in get_output
    parser = self._get_input_parser()
  File "/usr/local/lib/python3.10/site-packages/cyclonedx_py/client.py", line 247, in _get_input_parser
    return PipEnvParser(pipenv_contents=input_data)
  File "/usr/local/lib/python3.10/site-packages/cyclonedx_py/parser/pipenv.py", line 35, in __init__
    pipfile_lock_contents = json.loads(pipenv_contents)
  File "/usr/lib64/python3.10/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.10/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/python3.10/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 1 (char 0)

Using sys.stdin.isatty() in the following context will cause the file to be read automatically from stdin:

https://github.com/CycloneDX/cyclonedx-python/blob/a4a4c427f1fe97231f6e93e13c477030a7a9eed9/cyclonedx_py/client.py#L169-L170

And this will be followed by the above non descriptive error message.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jkowalleckcommented, Jan 25, 2022

In general I do prefer a cli that does explizit stdin setups using - as file indicator though.

totally agree. 👍

would you be okay to open another Issue with exactly this topic as a feature request, and describe expectations, benefits, risks etc?

1reaction
tvannahlcommented, Jan 25, 2022

That is correct. I would have expected the same behaviour within the pipeline as outside. But would be fine with a more descriptive error message - “I read from stdin and failed to find json”.

In general I do prefer a cli that does explizit stdin setups using - as file indicator though. To elaborate:

  • When reading from default files cyclonedx-bom --pip --format json -o bom.json
  • When reading from explicit file cyclonedx-bom --pip --format json -o bom.json -i MY_INPUT
  • When reading from stdin cyclonedx-bom --pip --format json -o bom.json -i -

Regardless whether there is a terminal connected or not.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Troubleshoot pipeline runs - Azure DevOps - Microsoft Learn
Learn how to troubleshoot pipeline runs in Azure Pipelines and Team Foundation Server.
Read more >
Azure DevOps pipeline release Error: No package found with ...
First, you could make sure you have generated the artifact for your build pipeline, check it from the build history in the build...
Read more >
Troubleshooting CI/CD - GitLab Docs
GitLab determines if a job is added to a pipeline based on the only/except or rules defined for the job. If it didn't...
Read more >
Pipeline Syntax - Jenkins
Unsupported credentials type causes the pipeline to fail with the message: org.jenkinsci.plugins.credentialsbinding.impl.CredentialNotFoundException: No ...
Read more >
Resolving Common Problems - AWS Data Pipeline
If both values are empty or missing, the task cannot start because there is no association between the task and a worker to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found