{"record":{"id":"96c33671c81e54dd","repo":"wavetermdev/waveterm","slug":"file-does-not-exist-q","errorCode":null,"errorMessage":"file does not exist: %q","messagePattern":"file does not exist: %q","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-editor.go","lineNumber":52,"sourceCode":"\tdefer func() {\n\t\tsendActivity(\"editor\", rtnErr == nil)\n\t}()\n\tif len(args) == 0 {\n\t\tOutputHelpMessage(cmd)\n\t\treturn fmt.Errorf(\"no arguments.  wsh editor requires a file or URL as an argument argument\")\n\t}\n\tif len(args) > 1 {\n\t\tOutputHelpMessage(cmd)\n\t\treturn fmt.Errorf(\"too many arguments.  wsh editor requires exactly one argument\")\n\t}\n\tfileArg := args[0]\n\tabsFile, err := filepath.Abs(fileArg)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting absolute path: %w\", err)\n\t}\n\t_, err = os.Stat(absFile)\n\tif err == fs.ErrNotExist {\n\t\treturn fmt.Errorf(\"file does not exist: %q\", absFile)\n\t}\n\tif err != nil {\n\t\treturn fmt.Errorf(\"getting file info: %w\", err)\n\t}\n\n\ttabId := getTabIdFromEnv()\n\tif tabId == \"\" {\n\t\treturn fmt.Errorf(\"no WAVETERM_TABID env var set\")\n\t}\n\n\twshCmd := wshrpc.CommandCreateBlockData{\n\t\tTabId: tabId,\n\t\tBlockDef: &waveobj.BlockDef{\n\t\t\tMeta: map[string]any{\n\t\t\t\twaveobj.MetaKey_View: \"preview\",\n\t\t\t\twaveobj.MetaKey_File: absFile,\n\t\t\t\twaveobj.MetaKey_Edit: true,\n\t\t\t},","sourceCodeStart":34,"sourceCodeEnd":70,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-editor.go#L34-L70","documentation":"Returned by wsh editor when the specified file path does not exist on disk.","triggerScenarios":"Running `wsh editor <path>` where the path does not exist on disk (typo, wrong directory, file deleted, or URL-handling path where a local file was expected).","commonSituations":"Typos in filenames; editing a file before creating it; paths relative to a different directory than expected; case-sensitivity mismatches on Linux.","solutions":["Verify the path exists (`ls <path>`) and fix typos","Create the file first, or use a different command to create it","Use an absolute path to rule out cwd confusion","Check case sensitivity of the filename"],"exampleFix":"// before\nwsh editor settngs.json  # typo\n// after\nwsh editor settings.json","handlingStrategy":"validation","validationCode":"if _, err := os.Stat(path); errors.Is(err, fs.ErrNotExist) {\n    return fmt.Errorf(\"file %q does not exist; create it first\", path)\n}","typeGuard":null,"tryCatchPattern":"if err := wsh.Editor(path); err != nil {\n    if strings.Contains(err.Error(), \"file does not exist\") {\n        os.Create(path) // then retry\n        err = wsh.Editor(path)\n    }\n}","preventionTips":["ls/touch the file before opening it in the editor","Use absolute paths to avoid cwd assumptions","Watch filename case on case-sensitive filesystems"],"tags":["filesystem","file-not-found","cli"],"backgroundTag":"file-not-found","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}