{"record":{"id":"f08c5f8596d3ba66","repo":"iflytek/astron-agent","slug":"docker-compose-config-failed-a-compose-implementation","errorCode":null,"errorMessage":"Docker Compose config failed; a Compose implementation supporting 'config --format json' is required","messagePattern":"Docker Compose config failed; a Compose implementation supporting 'config --format json' is required","errorType":"console","errorClass":"GateError","httpStatus":null,"severity":"error","filePath":"docker/astronAgent/scripts/verify_security_contract.py","lineNumber":164,"sourceCode":"\n\ndef _select_compose_command(compose_file: Path) -> Sequence[str]:\n    for base_command in _compose_commands():\n        completed = subprocess.run(\n            list(base_command)\n            + [\"-f\", compose_file.name, \"config\", \"--format\", \"json\"],\n            cwd=str(compose_file.parent),\n            stdout=subprocess.PIPE,\n            stderr=subprocess.PIPE,\n            universal_newlines=True,\n            check=False,\n        )\n        if completed.returncode == 0:\n            return base_command\n    if not _compose_commands():\n        raise GateError(\"Docker Compose is unavailable\")\n    # Compose stderr can contain interpolated deployment data. Do not echo it.\n    raise GateError(\n        \"Docker Compose config failed; a Compose implementation supporting \"\n        \"'config --format json' is required\"\n    )\n\n\ndef _render_compose(compose_file: Path) -> Mapping[str, Any]:\n    base_command = _select_compose_command(compose_file)\n    completed = subprocess.run(\n        list(base_command) + [\"-f\", compose_file.name, \"config\", \"--format\", \"json\"],\n        cwd=str(compose_file.parent),\n        stdout=subprocess.PIPE,\n        stderr=subprocess.PIPE,\n        universal_newlines=True,\n        check=False,\n    )\n\n    try:\n        rendered = json.loads(completed.stdout)","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/docker/astronAgent/scripts/verify_security_contract.py#L146-L182","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Upgrade to Docker Compose v2 (docker-compose-plugin) which supports 'config --format json'.","Run 'docker compose -f <file> config --format json' manually and fix the reported compose-file/validation error it prints.","Export all variables referenced with ${VAR} interpolation in the compose file (or provide a .env) so config renders.","If using legacy v1, replace the invocation path or pin a v2 binary on PATH ahead of docker-compose v1."],"exampleFix":"// before\ndocker-compose --version  # 1.29.2 -> no 'config --format json'\n// after\napt-get install -y docker-compose-plugin\ndocker compose -f docker/astronAgent/docker-compose.yml config --format json > /dev/null && echo ok","handlingStrategy":"validation","validationCode":"import subprocess\nc = subprocess.run([\"docker\",\"compose\",\"config\",\"--format\",\"json\"], capture_output=True)\nassert c.returncode == 0, c.stderr.decode()","typeGuard":null,"tryCatchPattern":"try:\n    render_compose(f)\nexcept GateError as e:\n    if \"config --format json\" in str(e):\n        upgrade_compose_or_fix_file()\n    raise","preventionTips":["Pin Compose v2 in dev/CI images.","Keep a valid .env with all interpolated variables.","Run 'compose config --format json' as a smoke test before the gate."],"tags":["docker","docker-compose","unsupported-version","config"],"backgroundTag":"unsupported-config-value","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}