{"record":{"id":"14a91921f21b2801","repo":"goharbor/harbor","slug":"bad-request-14a919","errorCode":"BAD_REQUEST","errorMessage":"addition %s isn't supported for %s","messagePattern":"addition (.+?) isn't supported for (.+?)","errorType":"error_code","errorClass":"lib/errors.Error","httpStatus":400,"severity":"error","filePath":"src/controller/artifact/processor/cnai/cnai.go","lineNumber":70,"sourceCode":"\t\treturn\n\t}\n}\n\ntype processor struct {\n\t*base.ManifestProcessor\n}\n\nfunc (p *processor) AbstractAddition(ctx context.Context, artifact *artifact.Artifact, addition string) (*ps.Addition, error) {\n\tvar additionParser parser.Parser\n\tswitch addition {\n\tcase AdditionTypeReadme:\n\t\tadditionParser = parser.NewReadme(p.RegCli)\n\tcase AdditionTypeLicense:\n\t\tadditionParser = parser.NewLicense(p.RegCli)\n\tcase AdditionTypeFiles:\n\t\tadditionParser = parser.NewFiles(p.RegCli)\n\tdefault:\n\t\treturn nil, errors.New(nil).WithCode(errors.BadRequestCode).\n\t\t\tWithMessagef(\"addition %s isn't supported for %s\", addition, ArtifactTypeCNAI)\n\t}\n\n\tmf, _, err := p.RegCli.PullManifest(artifact.RepositoryName, artifact.Digest)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\t_, payload, err := mf.Payload()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\tmanifest := &ocispec.Manifest{}\n\tif err := json.Unmarshal(payload, manifest); err != nil {\n\t\treturn nil, err\n\t}\n","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/controller/artifact/processor/cnai/cnai.go#L52-L88","documentation":"The CNAI processor maps addition requests to parsers: readme, license, and files are handled; anything else falls to the default branch and returns BadRequest 'addition %s isn't supported for CNAI'.","triggerScenarios":"GET .../artifacts/{ref}/additions/{x} on a CNAI artifact with x not in {readme, license, files} — e.g. values (chart-style) or build_history (image-style).","commonSituations":"Clients reusing chart or image addition vocabularies against AI artifacts; uniform addition probing across mixed repositories.","solutions":["Request only readme, license, or files additions for CNAI artifacts","Gate the request on the artifact type reported by the API","Keep a per-type allowlist of additions in the client instead of a single hardcoded addition name"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":"var cnaiAdditions = map[string]bool{\"readme\": true, \"license\": true, \"files\": true}\n\nfunc cnaiAdditionSupported(addition string) bool {\n    return cnaiAdditions[addition]\n}","tryCatchPattern":"if _, err := p.AbstractAddition(ctx, art, addition); err != nil {\n    if errors.IsErr(err, errors.BadRequestCode) && strings.Contains(err.Error(), \"CNAI\") {\n        // addition outside {readme, license, files}: skip\n    }\n}","preventionTips":["Use only readme, license, files for CNAI artifacts","Do not reuse chart (values) or image (build_history) addition names on AI artifacts","Maintain per-type addition allowlists in client code"],"tags":["go","harbor","cnai","additions","bad-request","ai-artifact"],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}