{"record":{"id":"c517594bf517e10c","repo":"charmbracelet/gum","slug":"file-not-found-w","errorCode":null,"errorMessage":"file not found: %w","messagePattern":"file not found: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"file/command.go","lineNumber":28,"sourceCode":"\t\"charm.land/bubbles/v2/help\"\n\ttea \"charm.land/bubbletea/v2\"\n\t\"charm.land/gum/v2/internal/timeout\"\n\t\"charm.land/gum/v2/style\"\n)\n\n// Run is the interface to picking a file.\nfunc (o Options) Run() error {\n\tif !o.File && !o.Directory {\n\t\treturn errors.New(\"at least one between --file and --directory must be set\")\n\t}\n\n\tif o.Path == \"\" {\n\t\to.Path = \".\"\n\t}\n\n\tpath, err := filepath.Abs(o.Path)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"file not found: %w\", err)\n\t}\n\n\tfp := filepicker.New()\n\tfp.CurrentDirectory = path\n\tfp.Path = path\n\tfp.SetHeight(o.Height)\n\tfp.AutoHeight = o.Height == 0\n\tfp.Cursor = o.Cursor\n\tfp.DirAllowed = o.Directory\n\tfp.FileAllowed = o.File\n\tfp.ShowPermissions = o.Permissions\n\tfp.ShowSize = o.Size\n\tfp.ShowHidden = o.All\n\tfp.Styles = filepicker.DefaultStyles()\n\tfp.Styles.Cursor = o.CursorStyle.ToLipgloss()\n\tfp.Styles.Symlink = o.SymlinkStyle.ToLipgloss()\n\tfp.Styles.Directory = o.DirectoryStyle.ToLipgloss()\n\tfp.Styles.File = o.FileStyle.ToLipgloss()","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/charmbracelet/gum/blob/4d089f95507708a71f64dacfe7ca513219dd5267/file/command.go#L10-L46","documentation":"Run converts the starting --path to an absolute path with filepath.Abs; if that fails (rare OS-level errors like excessively long or malformed paths), it is wrapped as 'file not found'. Note it wraps the abs-resolution error rather than an actual filesystem existence check.","triggerScenarios":"filepath.Abs(o.Path) returns an error inside Options.Run() — typically from os.Getwd failing or a pathological path value.","commonSituations":"Running from a deleted working directory (cwd removed); extremely long path values; passing NUL or otherwise invalid bytes in the path.","solutions":["Verify the starting directory exists and your shell's cwd is valid (cd to a real directory)","Pass a simpler/valid --path value","Check the wrapped cause (%w) for the underlying OS error"],"exampleFix":"// before\n(cd /deleted/dir && gum file --file)  # file not found: ...\n// after\ncd /valid/dir && gum file --file","handlingStrategy":"validation","validationCode":"[ -d \"$start_dir\" ] && cd \"$start_dir\" && gum file --file || echo 'invalid starting path'","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Confirm the starting directory exists before invoking","Avoid running from deleted working directories","Keep path values within OS length limits"],"tags":["cli","gum","file","path"],"backgroundTag":"path-resolution-failed","analyzedSha":"4d089f95507708a71f64dacfe7ca513219dd5267","analyzedAt":"2026-08-31T18:45:06.436Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}