{"record":{"id":"a5ebfcac0ad8950a","repo":"goharbor/harbor","slug":"failed-to-copy-content-to-buffer-w","errorCode":null,"errorMessage":"failed to copy content to buffer: %w","messagePattern":"failed to copy content to buffer: %w","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/controller/artifact/processor/cnai/parser/util.go","lineNumber":92,"sourceCode":"\t\theader, err := tr.Next()\n\t\tif err == io.EOF {\n\t\t\tbreak\n\t\t}\n\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to read tar header: %w\", err)\n\t\t}\n\n\t\t// skip the directory.\n\t\tif header.Typeflag == tar.TypeDir {\n\t\t\tcontinue\n\t\t}\n\n\t\t// Copy at most remaining+1 bytes so we can detect when the cumulative\n\t\t// content exceeds the limit without trusting the declared header size.\n\t\tn, err := io.Copy(&buf, io.LimitReader(tr, remaining+1))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to copy content to buffer: %w\", err)\n\t\t}\n\n\t\tremaining -= n\n\t\tif remaining < 0 {\n\t\t\treturn nil, errors.RequestEntityTooLargeError(errFileTooLarge)\n\t\t}\n\t}\n\n\treturn buf.Bytes(), nil\n}\n\n// FileType represents the type of a file.\ntype FileType = string\n\nconst (\n\tTypeFile      FileType = \"file\"\n\tTypeDirectory FileType = \"directory\"\n)","sourceCodeStart":74,"sourceCodeEnd":110,"githubUrl":"https://github.com/goharbor/harbor/blob/7b2fd08cc568955cca339afeefab27372840d936/src/controller/artifact/processor/cnai/parser/util.go#L74-L110","documentation":"Error \"failed to copy content to buffer: %w\" thrown in goharbor/harbor.","triggerScenarios":"Thrown at src/controller/artifact/processor/cnai/parser/util.go:92 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7b2fd08cc568955cca339afeefab27372840d936","analyzedAt":"2026-08-16T00:00:10.961Z","schemaVersion":2},"datasetVersion":"2026-08-16T03:17:38.424Z"}