{"record":{"id":"28de4dbfcf3daf9f","repo":"antonmedv/fx","slug":"read-s-w","errorCode":null,"errorMessage":"read %s: %w","messagePattern":"read (.+?): %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/engine/fxrc.go","lineNumber":49,"sourceCode":"\t}\n\n\txdgDirs := os.Getenv(\"XDG_CONFIG_DIRS\")\n\tif xdgDirs == \"\" {\n\t\txdgDirs = \"/etc/xdg\"\n\t}\n\tfor _, dir := range strings.Split(xdgDirs, \":\") {\n\t\tpaths = append(paths, filepath.Join(dir, \"fx\", \".fxrc.js\"))\n\t}\n\n\t// Read and combine\n\tfor _, path := range uniq(paths) {\n\t\tinfo, err := os.Stat(path)\n\t\tif err != nil || info.IsDir() {\n\t\t\tcontinue // skip missing or directories\n\t\t}\n\t\tdata, err := os.ReadFile(path)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"read %s: %w\", path, err)\n\t\t}\n\t\tbuilder.Write(data)\n\t\tbuilder.WriteString(\"\\n\")\n\t}\n\n\treturn builder.String(), nil\n}\n\nfunc uniq(paths []string) []string {\n\tseen := make(map[string]bool)\n\tresult := []string{}\n\tfor _, path := range paths {\n\t\tif !seen[path] {\n\t\t\tseen[path] = true\n\t\t\tresult = append(result, path)\n\t\t}\n\t}\n\treturn result","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/antonmedv/fx/blob/4f31cd3a0c5d66f1b4290a2719bab14a5cee8ebe/internal/engine/fxrc.go#L31-L67","documentation":"Wraps an os.ReadFile failure for an existing .fxrc.js config file discovered on the search path (cwd, home, XDG_CONFIG_HOME, XDG_CONFIG_DIRS). The file passed the Stat check but could not be read, typically due to permission denial or an I/O error, so rc-file loading aborts.","triggerScenarios":"Thrown at internal/engine/fxrc.go:49 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix permissions on the named file (chmod/chown)","Remove the unreadable .fxrc.js if it is no longer needed","Run fx with a XDG_CONFIG_DIRS that excludes the broken path"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4f31cd3a0c5d66f1b4290a2719bab14a5cee8ebe","analyzedAt":"2026-09-02T02:17:47.344Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}