Cortex Cloud: CortexCLI image sbom --output-file Flag Fails to Create File

Cortex Cloud: CortexCLI image sbom --output-file Flag Fails to Create File

131
Created On 03/09/26 09:45 AM - Last Modified 07/27/26 16:49 PM


Symptom


  • When running the cortexcli image sbom command with the --output-file parameter, the SBOM data is printed directly to the terminal (stdout). The expected JSON or text file is not created in the local directory despite the flag being present in the command string.


Environment


  • cortexcli
  • Cortex Cloud


Cause


  • The cortexcli utility utilizes an argument parsing logic that is sensitive to the order of operations. If flags such as --output-file or --output-format are placed after the positional image argument (e.g., nginx:1.25), the parser treats them as part of the positional data or ignores them, preventing the file-writing function from triggering.


Resolution


  • Reorder the command-line arguments so that all optional flags are placed before the positional image name.
    • Incorrect syntax:
      cortexcli image sbom <image_name> --output-file <filename>.json
    • Correct syntax:
      cortexcli image sbom --output-file <filename>.json <image_name>


Additional Information


  • Ensure all global and command-specific flags are defined before the final positional arguments in cortexcli to ensure consistent flag parsing across different sub-commands.


Actions
  • Print
  • Copy Link

    https://knowledgebase.paloaltonetworks.com/KCSArticleDetail?id=kA1Ki000000wkhgKAA&lang=en_US&refURL=http%3A%2F%2Fknowledgebase.paloaltonetworks.com%2FKCSArticleDetail