{"record":{"id":"b98079c21cd4840b","repo":"cilium/cilium","slug":"opening-s-w","errorCode":null,"errorMessage":"opening %s: %w","messagePattern":"opening (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tools/dpgen/maps.go","lineNumber":114,"sourceCode":"\t\t\t\t\treturn err\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tobjsDone.Insert(objName)\n\t}\n\n\tbtfBlob, err := marshalSorted(bb)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"marshaling combined BTF: %w\", err)\n\t}\n\tif err := os.WriteFile(mapKVFile, btfBlob, 0644); err != nil {\n\t\treturn fmt.Errorf(\"writing %s: %w\", mapKVFile, err)\n\t}\n\n\tf, err := os.Create(mapsGoFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"opening %s: %w\", mapsGoFile, err)\n\t}\n\tdefer f.Close()\n\n\tif err := renderMapSpecs(f, outer, inner, mapsOpts.goPkg); err != nil {\n\t\treturn fmt.Errorf(\"rendering MapSpecs: %w\", err)\n\t}\n\n\tf, err = os.Create(mapsGoTestFile)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"opening %s: %w\", mapsGoTestFile, err)\n\t}\n\tdefer f.Close()\n\n\tif err := renderMapSpecsTest(f, mapsOpts.goPkg); err != nil {\n\t\treturn fmt.Errorf(\"rendering MapSpecs test: %w\", err)\n\t}\n\n\treturn nil","sourceCodeStart":96,"sourceCodeEnd":132,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/tools/dpgen/maps.go#L96-L132","documentation":"After writing the BTF blob, runMaps creates maps_generated.go with os.Create to hold rendered MapSpec Go code. This error wraps the os.Create failure for that output file, meaning the generator cannot produce the Go source file.","triggerScenarios":"os.Create(mapsGoFile) fails: maps_generated.go exists with read-only permissions, the directory is not writable, or the path is a directory.","commonSituations":"A previously generated maps_generated.go was checked in or chowned by root and is now read-only; running the generator as a different (unprivileged) user in CI; running from a read-only mounted directory.","solutions":["Check the wrapped OS error and fix permissions on maps_generated.go (e.g. chmod u+w) or delete it","Ensure the process runs as a user with write access to the target directory","Verify the working directory is writable before running the dpgen maps command"],"exampleFix":"// before\n-r--r--r-- maps_generated.go\n// after\n$ chmod u+w maps_generated.go && dpgen maps datapath/bpf/*.o","handlingStrategy":"validation","validationCode":"if info, err := os.Stat(mapsGoFile); err == nil && info.Mode().Perm()&0200 == 0 {\n\treturn fmt.Errorf(\"%s is not writable; run chmod u+w %s\", mapsGoFile, mapsGoFile)\n}","typeGuard":null,"tryCatchPattern":"if err := runMaps(cmd, args); err != nil {\n\tvar pe *fs.PathError\n\tif errors.As(err, &pe) && errors.Is(pe.Err, syscall.EACCES) {\n\t\tlog.Fatalf(\"fix permissions on %s before regenerating\", pe.Path)\n\t}\n\treturn err\n}","preventionTips":["Don't check generated files in with read-only modes","Run codegen as the same user that owns the checkout","Delete generated files before regenerating in CI"],"tags":["filesystem","write-failure","codegen"],"backgroundTag":"file-write-permission-denied","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}