{"record":{"id":"899801cbaa77ec90","repo":"kovidgoyal/kitty","slug":"s-is-not-a-valid-path-with-error-w","errorCode":null,"errorMessage":"%s is not a valid path with error: %w","messagePattern":"(.+?) is not a valid path with error: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"tools/cmd/at/screenshot.go","lineNumber":39,"sourceCode":"}\n\nfunc read_screenshot_args(io_data *rc_io_data, args []string) (func(io_data *rc_io_data) (bool, error), error) {\n\tif len(args) > 1 {\n\t\treturn nil, fmt.Errorf(\"%s\", \"Must specify at most one output file\")\n\t}\n\tif len(args) == 0 {\n\t\t// kitty writes the screenshot directly to the output file when one is\n\t\t// given (it runs on the same computer as kitty), so a custom response\n\t\t// handler is only needed to write the PNG data to STDOUT.\n\t\tio_data.handle_response = screenshot_handle_response\n\t}\n\treturn func(io_data *rc_io_data) (bool, error) {\n\t\t// io_data.rc.Payload is only populated after this generator is created,\n\t\t// so the payload field must be set here rather than above.\n\t\tif len(args) == 1 {\n\t\t\tpath, err := filepath.Abs(utils.Expanduser(args[0]))\n\t\t\tif err != nil {\n\t\t\t\treturn false, fmt.Errorf(\"%s is not a valid path with error: %w\", args[0], err)\n\t\t\t}\n\t\t\tset_payload_string_field(io_data, \"Output_path\", path)\n\t\t}\n\t\treturn true, nil\n\t}, nil\n}\n","sourceCodeStart":21,"sourceCodeEnd":46,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/tools/cmd/at/screenshot.go#L21-L46","documentation":"While preparing the screenshot payload, kitty @ could not convert the given output path to an absolute path (filepath.Abs failed after Expanduser). This is a local filesystem error on the client side, before kitty is even contacted.","triggerScenarios":"The payload generator calls filepath.Abs(utils.Expanduser(args[0])); failure typically means getwd failed or the expanded path is invalid on this OS.","commonSituations":"Current directory has been deleted out from under the shell, exotic paths after ~ expansion, or permission problems on the working directory in restricted environments.","solutions":["Check that your current working directory still exists and is accessible (pwd)","Use an absolute path for the output file to sidestep Abs() resolution","Ensure ~ expands to a valid, writable home directory"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if _, err := filepath.Abs(p); err != nil { /* use an explicit absolute path instead */ }","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"not a valid path\") { /* retry with an absolute path */ }","preventionTips":["Prefer absolute output paths for @ screenshot","Ensure the current working directory exists"],"tags":["kitty","screenshot","filesystem","path"],"backgroundTag":"invalid-file-path","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}