{"record":{"id":"b58069d96b5bf647","repo":"docker/compose","slug":"unsupported-oci-version-s","errorCode":null,"errorMessage":"unsupported OCI version: %s","messagePattern":"unsupported OCI version: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/oci/push.go","lineNumber":194,"sourceCode":"\t\t// tooling falls back to the config media type, so this is used to\n\t\t// indicate that it's not a container image but custom content.\n\t\tconfigData := []byte(\"{}\")\n\t\tconfig = v1.Descriptor{\n\t\t\tMediaType: ComposeEmptyConfigMediaType,\n\t\t\tDigest:    digest.FromBytes(configData),\n\t\t\tSize:      int64(len(configData)),\n\t\t\tData:      configData,\n\t\t}\n\t\t// N.B. OCI 1.0 does NOT support specifying the artifact type, so it's\n\t\t//\t\tleft as an empty string to omit it from the marshaled JSON\n\t\tartifactType = \"\"\n\t\ttoPush = append(toPush, config)\n\tcase api.OCIVersion1_1:\n\t\tconfig = v1.DescriptorEmptyJSON\n\t\tartifactType = ComposeProjectArtifactType\n\t\ttoPush = append(toPush, config)\n\tdefault:\n\t\treturn v1.Descriptor{}, nil, fmt.Errorf(\"unsupported OCI version: %s\", ociCompat)\n\t}\n\n\tmanifest, err := json.Marshal(v1.Manifest{\n\t\tVersioned:    specs.Versioned{SchemaVersion: 2},\n\t\tMediaType:    v1.MediaTypeImageManifest,\n\t\tArtifactType: artifactType,\n\t\tConfig:       config,\n\t\tLayers:       layers,\n\t\tAnnotations: map[string]string{\n\t\t\t\"org.opencontainers.image.created\": time.Now().Format(time.RFC3339),\n\t\t},\n\t})\n\tif err != nil {\n\t\treturn v1.Descriptor{}, nil, err\n\t}\n\n\tmanifestDescriptor := v1.Descriptor{\n\t\tMediaType: v1.MediaTypeImageManifest,","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/docker/compose/blob/ddc4b044b62e9f715212ea4143fa830fac76382f/internal/oci/push.go#L176-L212","documentation":"When pushing a compose project as an OCI artifact, push.go builds a manifest according to the requested OCI compat version and only knows how to lay out 1.0 (config layer with project bytes, empty artifactType) and 1.1 (empty-JSON config descriptor plus ComposeProjectArtifactType). Any other value in the version variable hits the default arm and is rejected before any network I/O.","triggerScenarios":"Calling the artifact push path with an ociCompat value other than api.OCIVersion1_0/OCIVersion1_1 — typically a new constant added to the API package without extending this switch, or a caller-supplied string parsed into an unhandled value (e.g. via a future --oci-compat variant flag).","commonSituations":"Version skew after adding a new OCI version constant to internal/api without updating push.go; tests iterating all api.OCIVersion* constants; hand-rolled callers passing a raw version string instead of the defined constants.","solutions":["Use one of the supported constants (api.OCIVersion1_1 for modern registries, api.OCIVersion1_0 for strict 1.0 registries).","If you introduced a new version constant, add a case to the switch in push.go mapping it to the right config/artifactType layout.","Validate the version at the CLI/config boundary so unhandled values fail with a clear message before push starts.","Check which values your compose build supports: grep for OCIVersion in internal/api."],"exampleFix":"// before (caller)\nociCompat := \"1.2\" // unhandled by push.go\n\n// after (caller)\nociCompat := api.OCIVersion1_1 // or api.OCIVersion1_0","handlingStrategy":"validation","validationCode":"switch ociCompat {\ncase api.OCIVersion1_0, api.OCIVersion1_1:\ndefault:\n    return fmt.Errorf(\"unsupported OCI version %q; use %s or %s\", ociCompat, api.OCIVersion1_0, api.OCIVersion1_1)\n}","typeGuard":"func supportedOCIVersion(v api.OCIVersion) bool {\n    return v == api.OCIVersion1_0 || v == api.OCIVersion1_1\n}","tryCatchPattern":null,"preventionTips":["Only use the api package's OCIVersion constants.","Validate the version at flag-parsing time, before push begins.","When adding a version constant, extend the push.go switch in the same change."],"tags":["oci","artifact","registry","push","go"],"backgroundTag":null,"analyzedSha":"ddc4b044b62e9f715212ea4143fa830fac76382f","analyzedAt":"2026-08-15T13:31:42.319Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}