{"record":{"id":"01bd4fca3b7e2ad9","repo":"golang/go","slug":"error-opening-file-created-by-svn-export-v","errorCode":null,"errorMessage":"error opening file created by 'svn export': %v","messagePattern":"error opening file created by 'svn export': (.+?)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cmd/go/internal/modfetch/codehost/svn.go","lineNumber":154,"sourceCode":"\tbasePath := path.Join(path.Base(remote), subdir)\n\n\tzw := zip.NewWriter(dst)\n\tfor _, e := range list.Entries {\n\t\tif e.Kind != \"file\" {\n\t\t\tcontinue\n\t\t}\n\n\t\tzf, err := zw.Create(path.Join(basePath, e.Name))\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tf, err := os.Open(filepath.Join(exportDir, e.Name))\n\t\tif err != nil {\n\t\t\tif os.IsNotExist(err) {\n\t\t\t\treturn vcsErrorf(\"file reported by 'svn list', but not written by 'svn export': %s\", e.Name)\n\t\t\t}\n\t\t\treturn fmt.Errorf(\"error opening file created by 'svn export': %v\", err)\n\t\t}\n\n\t\tn, err := io.Copy(zf, f)\n\t\tf.Close()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\t\tif n != e.Size {\n\t\t\treturn vcsErrorf(\"file size differs between 'svn list' and 'svn export': file %s listed as %v bytes, but exported as %v bytes\", e.Name, e.Size, n)\n\t\t}\n\t}\n\n\treturn zw.Close()\n}\n","sourceCodeStart":136,"sourceCodeEnd":169,"githubUrl":"https://github.com/golang/go/blob/b6b368adc57c96c3151d224d172029f233ead2c3/src/cmd/go/internal/modfetch/codehost/svn.go#L136-L169","documentation":"svnReadZip iterates over entries returned by `svn list` and opens each file produced by `svn export`. When os.Open fails with an error that is NOT IsNotExist (which has its own dedicated message), the generic opening error is returned with %v. Indicates a permission, I/O, or concurrency problem with the exported file, not a missing file.","triggerScenarios":"File listed by `svn list` exists on disk after export but cannot be opened — permissions denied, file locked, race with another process removing it, or filesystem error.","commonSituations":"Concurrent go commands sharing an svn work directory; antivirus or SELinux denying reads of the export; svn export partially failed leaving zero-byte or locked files; disk full mid-export.","solutions":["Run `go clean -cache` to discard the corrupted svn export tree and retry.","Ensure no other go command or svn process is concurrently using the same work directory.","Check filesystem permissions and SELinux/AppArmor denials on GOCACHE and the export dir.","Free disk space — svn export may have produced truncated files due to ENOSPC."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"// svn export is racy with the filesystem — retry once after clearing the export dir.\nerr := svnReadZip(...)\nif err != nil && strings.Contains(err.Error(), \"error opening file created by 'svn export'\") {\n    os.RemoveAll(exportDir)\n    err = svnReadZip(...)\n}","preventionTips":["Serialise go commands that touch the same svn work dir to avoid export races.","Keep GOCACHE on a healthy, writable filesystem with adequate free space.","Prefer git-backed modules or the module proxy over svn to sidestep the export-scraping path."],"tags":["svn","filesystem","permissions","io"],"backgroundTag":null,"analyzedSha":"b6b368adc57c96c3151d224d172029f233ead2c3","analyzedAt":"2026-08-12T00:22:02.250Z","schemaVersion":2},"datasetVersion":"2026-08-12T12:31:55.035Z"}