iflytek/astron-agent · error · GateError

Docker Compose config failed; a Compose implementation…

Error message

Docker Compose config failed; a Compose implementation supporting 'config --format json' is required

What it means

verify_security_contract.py raises this GateError from _select_compose_command when at least one Compose binary exists but every candidate fails 'config --format json' (non-zero exit). The script requires a Compose implementation capable of emitting the rendered config as JSON, and it deliberately does not echo stderr because it can contain interpolated deployment secrets.

Solutions

  1. Upgrade to Docker Compose v2 (docker-compose-plugin) which supports 'config --format json'.
  2. Run 'docker compose -f <file> config --format json' manually and fix the reported compose-file/validation error it prints.
  3. Export all variables referenced with ${VAR} interpolation in the compose file (or provide a .env) so config renders.
  4. If using legacy v1, replace the invocation path or pin a v2 binary on PATH ahead of docker-compose v1.

Example fix

// before
docker-compose --version  # 1.29.2 -> no 'config --format json'
// after
apt-get install -y docker-compose-plugin
docker compose -f docker/astronAgent/docker-compose.yml config --format json > /dev/null && echo ok
Defensive patterns

Strategy: validation

Validate before calling

import subprocess
c = subprocess.run(["docker","compose","config","--format","json"], capture_output=True)
assert c.returncode == 0, c.stderr.decode()

Try / catch

try:
    render_compose(f)
except GateError as e:
    if "config --format json" in str(e):
        upgrade_compose_or_fix_file()
    raise

Prevention

When it happens

Trigger: Any compose command candidate (docker compose / docker-compose) exists but returns non-zero from 'compose config --format json', e.g. because the compose file is invalid, an older v1 binary lacks --format json, or environment interpolation variables are unset.

Common situations: docker-compose v1 (Python) installed, which doesn't support 'config --format json'; malformed or missing compose file; required .env variables unset causing interpolation failures; corrupted docker installation.

Related errors


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/f08c5f8596d3ba66. Report an issue: GitHub.

Appendix: source

Thrown at docker/astronAgent/scripts/verify_security_contract.py:164


def _select_compose_command(compose_file: Path) -> Sequence[str]:
    for base_command in _compose_commands():
        completed = subprocess.run(
            list(base_command)
            + ["-f", compose_file.name, "config", "--format", "json"],
            cwd=str(compose_file.parent),
            stdout=subprocess.PIPE,
            stderr=subprocess.PIPE,
            universal_newlines=True,
            check=False,
        )
        if completed.returncode == 0:
            return base_command
    if not _compose_commands():
        raise GateError("Docker Compose is unavailable")
    # Compose stderr can contain interpolated deployment data. Do not echo it.
    raise GateError(
        "Docker Compose config failed; a Compose implementation supporting "
        "'config --format json' is required"
    )


def _render_compose(compose_file: Path) -> Mapping[str, Any]:
    base_command = _select_compose_command(compose_file)
    completed = subprocess.run(
        list(base_command) + ["-f", compose_file.name, "config", "--format", "json"],
        cwd=str(compose_file.parent),
        stdout=subprocess.PIPE,
        stderr=subprocess.PIPE,
        universal_newlines=True,
        check=False,
    )

    try:
        rendered = json.loads(completed.stdout)

View on GitHub (pinned to 5e758547a8)