action icon indicating copy to clipboard operation
action copied to clipboard

SyntaxError while publishing: "Unexpected token r in JSON at position 0"

Open PureTryOut opened this issue 7 months ago • 0 comments

I'm trying to publish a feature but am failing to do so. Although to me the contents of the repo seem correct it fails with an error that doesn't really tell me anything:

[2025-05-19T20:20:21.191Z] Packaging feature collection...
[2025-05-19T20:20:21.194Z] Processing feature: starship...
[2025-05-19T20:20:21.216Z] Packaged 1 features!
[2025-05-19T20:20:21.216Z] Processing feature: starship...
[2025-05-19T20:20:21.217Z] Fetching published versions...
[2025-05-19T20:20:21.314Z] Publishing tags: 1,1.0,1.0.0,latest...
[2025-05-19T20:20:21.316Z] Data layer digest: sha256:506a0c07c447a52f751d546fd465145f534790be0456c088a59f7b2af161284e (archive size: 6144)
[2025-05-19T20:20:21.316Z] Computed content digest from manifest: sha256:da7f47bc8d89feb98a7c3cdd108558b377e182e0accb6d0c58cd7039b5ac42ad
SyntaxError: Unexpected token r in JSON at position 0
    at JSON.parse (<anonymous>)
    at kJ (/opt/acttoolcache/node/18.20.8/x64/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:608:1596)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async mJ (/opt/acttoolcache/node/18.20.8/x64/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:605:579)
    at async cC (/opt/acttoolcache/node/18.20.8/x64/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:609:1298)
    at async Vz (/opt/acttoolcache/node/18.20.8/x64/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:609:2795)
    at async /opt/acttoolcache/node/18.20.8/x64/lib/node_modules/@devcontainers/cli/dist/spec-node/devContainersSpecCLI.js:484:1188
::error::The process '/opt/acttoolcache/node/18.20.8/x64/bin/devcontainer' failed with exit code 1
::error::(!) Failed to publish Features.

I don't know what JSON this would be that it's failing to parse.

Using the action as follows (with env.REGISTRY_URL being a valid registry url which https://github.com/docker/login-action@v3 managed to successfully login to):

      - name: "Publish Features"
        uses: "https://github.com/devcontainers/action@v1"
        with:
          publish-features: "true"
          oci-registry: "${{ env.REGISTRY_URL }}"
          base-path-to-features: "./src"
          generate-docs: "false"

Also if I only validate the repo contents, using the contents of https://github.com/devcontainers/feature-starter/blob/main/.github/workflows/validate.yml, the validation passes successfully.

PureTryOut avatar May 19 '25 20:05 PureTryOut