antonmedv/fx · error
get cwd: %w
Error message
get cwd: %w
What it means
Wraps a failure of os.Getwd() while readFxrc builds its list of .fxrc.js search paths. The current working directory cannot be determined (e.g. the directory was deleted or the process lacks permission to stat it), so the cwd-based config path cannot be computed and config loading aborts.
Source
Thrown at internal/engine/fxrc.go:16
package engine
import (
"fmt"
"os"
"path/filepath"
"strings"
)
func readFxrc() (string, error) {
var builder strings.Builder
// Determine search paths
cwd, err := os.Getwd()
if err != nil {
return "", fmt.Errorf("get cwd: %w", err)
}
paths := []string{filepath.Join(cwd, ".fxrc.js")}
home, err := os.UserHomeDir()
if err == nil {
paths = append(paths, filepath.Join(home, ".fxrc.js"))
}
xdgHome := os.Getenv("XDG_CONFIG_HOME")
if xdgHome == "" && home != "" {
xdgHome = filepath.Join(home, ".config")
}
if xdgHome != "" {
paths = append(paths, filepath.Join(xdgHome, "fx", ".fxrc.js"))
}
xdgDirs := os.Getenv("XDG_CONFIG_DIRS")
if xdgDirs == "" {View on GitHub (pinned to 4f31cd3a0c)
Solutions
- cd back into a valid directory before running fx
- Restore or recreate the deleted working directory
- Check filesystem/mount health if Getwd fails persistently
Defensive patterns
Strategy: fallback
When it happens
Trigger: Thrown at internal/engine/fxrc.go:16 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of antonmedv/fx@4f31cd3a0c (2026-09-02).
Data as JSON: /api/errors/ac50aa742df0dc3e.
Report an issue: GitHub.