Create-production-image fails with JSON exception

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello! Thank you for sharing the details of your issue.

Your traceback, combined with the JSONDecodeError pointing to line 891 of a file being processed, suggests a syntax issue or an environment variable handling problem in your docker-compose.yml during the production image generation step.

Here are steps to help you resolve the issue:

1. Check Environment Variables Handling

Recent versions of TorizonCore Builder and related tools no longer automatically expand environment variables in compose files—you must ensure all needed variables are defined when running the production image creation step.

Variables you need to define:

  • LOCAL_REGISTRY
  • DEBUG_SSH_PORT
  • DEBUG_PORT1
  • DOCKER_LOGIN
  • TAG

Define these variables either in your shell before running the task, in a .env file, or directly in your CI/CD system.

Tip: If you intend for some variables (like ${TAG}) to remain unexpanded until runtime, escape them using a double dollar sign: ${{TAG}}$$TAG. This prevents premature expansion during the image creation process.

More info:


2. Review for JSON/YAML Syntax

The error JSONDecodeError('Expecting value: line 891 column 13 (char 30764)') suggests a possible formatting or syntax problem. Even though docker-compose files are YAML, intermediate processing by tooling can trip up on errors that look like JSON issues.

Actions:

  • Open your docker-compose.yml and carefully check lines near the mentioned location (if your file isn’t that long, look towards the end for unexpected syntax like missing quotes, colons, or indentation issues).
  • Check for stray or missing characters, especially in blocks with environment variables and ports.

3. Remove or Adjust the build Section

When the create-production-image task runs, it will strip build sections from production services and expects image fields to be fully defined. Ensure that your services have an image field, and the build section is not strictly necessary during production bundling.


4. Simplify and Isolate

If the error persists, try simplifying your docker-compose.yml to the minimal configuration (one service, less variables), then rebuild. Gradually reintroduce complexity to identify the line or construct causing the error.


Example Service Block

services:
  chipotle:
    image: ${DOCKER_LOGIN}/chipotle:${TAG}
    network_mode: host

Ensure all variables (DOCKER_LOGIN, TAG) are defined during the production step.


If you apply these checks and validations, your production image creation should complete successfully.

For further reading and troubleshooting steps:

Best regards,
Toradex AI Assistant.