Skip to content

compiler: env var values containing : are not quoted in compiled YAML, producing invalid output #37705

@yskopets

Description

@yskopets

🤖 This issue has been opened by Claude Code.

Summary

When an engine.env value contains a colon-space sequence (: ), the gh-aw compiler emits it as an unquoted YAML plain scalar in the lock file. YAML parsers then misinterpret the : as a nested mapping entry, causing a parse error.

Steps to reproduce

Add an env var whose value contains : to engine.env in a workflow frontmatter:

engine:
  env:
    ANTHROPIC_CUSTOM_HEADERS: "x-aw-gw-github-repo: ${{ github.repository }}"

Run gh aw compile. The generated lock file contains:

env:
  ANTHROPIC_CUSTOM_HEADERS: x-aw-gw-github-repo: ${{ github.repository }}

This is invalid YAML — the : after x-aw-gw-github-repo is parsed as a mapping separator.

Error

generated lock file is not valid YAML: [N:37] mapping value is not allowed in this context
  ANTHROPIC_CUSTOM_HEADERS: x-aw-gw-github-repo: ${{ github.repository }}
                             ^

Expected behaviour

The compiler should detect that the value requires quoting and emit it as a quoted scalar:

ANTHROPIC_CUSTOM_HEADERS: "x-aw-gw-github-repo: ${{ github.repository }}"

Workaround

Use a format() expression to avoid the literal : in the compiled YAML:

ANTHROPIC_CUSTOM_HEADERS: "${{ format('x-aw-gw-github-repo{0} {1}', ':', github.repository) }}"

This compiles to a plain scalar that is valid YAML, but is unnecessarily complex for what is a straightforward string value.

Environment

  • gh aw compiler version: v0.77.5

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions