{"record":{"id":"ad359aab4ed99d2c","repo":"docker/cli","slug":"unsupported-compose-file-version-s","errorCode":null,"errorMessage":"unsupported Compose file version: %s","messagePattern":"unsupported Compose file version: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/compose/schema/schema.go","lineNumber":82,"sourceCode":"\nfunc normalizeVersion(version string) string {\n\tswitch version {\n\tcase \"\", \"3\":\n\t\treturn defaultVersion\n\tdefault:\n\t\treturn version\n\t}\n}\n\n//go:embed data/config_schema_v*.json\nvar schemas embed.FS\n\n// Validate uses the jsonschema to validate the configuration\nfunc Validate(config map[string]any, version string) error {\n\tversion = normalizeVersion(version)\n\tschemaData, err := schemas.ReadFile(\"data/config_schema_v\" + version + \".json\")\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unsupported Compose file version: %s\", version)\n\t}\n\n\tschemaLoader := gojsonschema.NewStringLoader(string(schemaData))\n\tdataLoader := gojsonschema.NewGoLoader(config)\n\n\tresult, err := gojsonschema.Validate(schemaLoader, dataLoader)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tif !result.Valid() {\n\t\treturn toError(result)\n\t}\n\n\treturn nil\n}\n\nfunc toError(result *gojsonschema.Result) error {","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/docker/cli/blob/4f84911bfe8811e9b028e4b1fee8e7510be79387/cli/compose/schema/schema.go#L64-L100","documentation":"Raised by schema.Validate when the embedded schema file for the requested Compose version cannot be read (schema.go:80-82). The version is normalized (empty or \"3\" becomes \"3.13\"), then the code looks for `data/config_schema_v<version>.json`. A read failure means no embedded schema matches that version, so the Compose file declares a version the bundled CLI does not know.","triggerScenarios":"Calling schema.Validate(config, version) with a version string that does not correspond to any embedded `config_schema_v*.json` file (after normalization). E.g. version \"2.0\" when only \"2.1\"–\"3.13\" schemas are bundled, or a malformed version like \"3x\".","commonSituations":"A Compose file declares an unsupported or misspelled `version:` (e.g. `version: \"4\"`, `version: \"2.0.0\"`, or a removed/old version). Upgrading the Docker CLI can drop schemas for deprecated versions; downgrading a file to a version newer than the CLI supports produces it too.","solutions":["Check the `version:` field in the Compose file and set it to a supported value (e.g. \"3.13\" or remove the field entirely so the default 3.13 is used).","Upgrade the Docker CLI to a version that bundles the schema for the declared Compose version.","Run `docker compose config` to confirm the version is accepted before deploying."],"exampleFix":"// before\nversion: \"2.0\"\n// after (omit to use default latest, or pin a supported value)\n# version: \"3.13\"","handlingStrategy":"validation","validationCode":"// Validate the version against the known supported set before calling Validate.\nvar supported = map[string]bool{\"2.1\":true,\"2.2\":true,\"2.3\":true,\"2.4\":true,\"3\":true,\"3.1\":true,\"3.13\":true}\nif !supported[version] {\n    return fmt.Errorf(\"unsupported Compose version %q; use 3.13 or omit version\", version)\n}","typeGuard":"func isSupportedVersion(v string) bool {\n    switch v {\n    case \"\", \"3\", \"2.1\",\"2.2\",\"2.3\",\"2.4\",\"3.1\",\"3.13\":\n        return true\n    }\n    return false\n}","tryCatchPattern":"if err := schema.Validate(config, version); err != nil {\n    return fmt.Errorf(\"schema validation: %w\", err)\n}","preventionTips":["Omit the version field to use the latest default (3.13).","Upgrade the Docker CLI to match the Compose spec you author.","Run `docker compose config` to validate before deploying."],"tags":["compose","schema","version","jsonschema"],"backgroundTag":null,"analyzedSha":"4f84911bfe8811e9b028e4b1fee8e7510be79387","analyzedAt":"2026-08-07T12:15:29.814Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}