{"record":{"id":"b33bcd48a142f83b","repo":"golang/go","slug":"cannot-find-data","errorCode":null,"errorMessage":"cannot find .data","messagePattern":"cannot find \\.data","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/link/internal/ld/fips140.go","lineNumber":508,"sourceCode":"\tif err != nil {\n\t\treturn err\n\t}\n\tdefer wf.Close()\n\n\tf, err := newFipsObj(wf, fipso)\n\tif err != nil {\n\t\treturn err\n\t}\n\tdefer f.Close()\n\n\t// Find the go:fipsinfo symbol.\n\t// PE does not put it in its own section, so we have to scan for it.\n\t// It is near the start of the data segment, right after go:buildinfo,\n\t// so we should not have to scan too far.\n\tconst maxScan = 16 << 20\n\tsect := pf.Section(\".data\")\n\tif sect == nil {\n\t\treturn fmt.Errorf(\"cannot find .data\")\n\t}\n\tb := bufio.NewReader(sect.Open())\n\toff := int64(0)\n\tdata := make([]byte, fipsMagicLen+fipsSumLen+9*ctxt.Arch.PtrSize)\n\tfor ; ; off += 16 {\n\t\tif off >= maxScan {\n\t\t\tbreak\n\t\t}\n\t\tif _, err := io.ReadFull(b, data[:fipsMagicLen]); err != nil {\n\t\t\treturn fmt.Errorf(\"scanning PE for FIPS magic: %v\", err)\n\t\t}\n\t\tif string(data[:fipsMagicLen]) == fipsMagic {\n\t\t\tif _, err := io.ReadFull(b, data[fipsMagicLen:]); err != nil {\n\t\t\t\treturn fmt.Errorf(\"scanning PE for FIPS magic: %v\", err)\n\t\t\t}\n\t\t\tbreak\n\t\t}\n\t}","sourceCodeStart":490,"sourceCodeEnd":526,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/link/internal/ld/fips140.go#L490-L526","documentation":"During PE (Windows) FIPS 140 post-link processing, the linker opens the binary and looks for the .data section using pe.File.Section(\".data\"). PE does not use a dedicated section for FIPS info; instead, the info is embedded within the .data section near go:buildinfo. If .data is missing, the scan cannot proceed.","triggerScenarios":"The pefips function calls pf.Section(\".data\") on the opened PE binary. If the return is nil (section not found), the error is returned. The subsequent code scans up to 16 MB of .data for the FIPS magic bytes.","commonSituations":"The PE binary was produced by a non-standard linker or tool that renames or omits the .data section; the binary was heavily stripped or transformed; a Go version bug in PE section naming; cross-compilation environment producing non-standard PE layouts.","solutions":["Clean rebuild: go clean -cache && GOFIPS=1 go build","Verify the binary is a standard Go-produced PE executable","Check if external tools (e.g. UPX, PE compressors) renamed or merged sections","Report as a Go linker bug if the binary is unmodified","Try -linkmode=external vs internal to see if section layout differs"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Before PE FIPS post-link, verify .data section exists\nfunc verifyPEDataSection(exe string) error {\n    pf, err := pe.Open(exe)\n    if err != nil {\n        return err\n    }\n    defer pf.Close()\n    if pf.Section(\".data\") == nil {\n        return fmt.Errorf(\"PE binary lacks .data section — was it produced by a standard Go build?\")\n    }\n    return nil\n}","typeGuard":null,"tryCatchPattern":"// Handle missing .data section with diagnostic guidance\nsect := pf.Section(\".data\")\nif sect == nil {\n    return fmt.Errorf(\"cannot find .data (verify binary is unmodified Go PE output)\")\n}","preventionTips":["Do not run PE modification tools (UPX, PE compressors) on FIPS-enabled binaries","Verify the binary is produced by a standard go build command","Avoid external tools that rename or merge PE sections","Report non-standard PE layouts to the Go project"],"tags":["fips","fips140","pe","linker","go-toolchain","windows"],"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T06:17:24.410Z"}