{"record":{"id":"91276e5c670762b4","repo":"joewalnes/websocketd","slug":"your-s-s-is-not-pointing-to-an-accessible-dire","errorCode":null,"errorMessage":"your %s '%s' is not pointing to an accessible directory","messagePattern":"your (.+?) '(.+?)' is not pointing to an accessible directory","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config.go","lineNumber":238,"sourceCode":"\t}\n\tinf, err := os.Stat(absDir)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"could not find your script dir '%s'\", dir)\n\t}\n\tif !inf.IsDir() {\n\t\treturn \"\", fmt.Errorf(\"did you mean to specify COMMAND instead of --dir '%s'?\", dir)\n\t}\n\treturn absDir, nil\n}\n\n// validateDir checks that a directory path exists and is a directory.\nfunc validateDir(dir, label string) error {\n\tif dir == \"\" {\n\t\treturn nil\n\t}\n\tinf, err := os.Stat(dir)\n\tif err != nil || !inf.IsDir() {\n\t\treturn fmt.Errorf(\"your %s '%s' is not pointing to an accessible directory\", label, dir)\n\t}\n\treturn nil\n}\n\nfunc parseCommandLine() *Config {\n\tvar mainConfig Config\n\tvar config libwebsocketd.Config\n\n\tflag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ContinueOnError)\n\tflag.CommandLine.Usage = func() {}\n\n\t// If adding new command line options, also update the help text in help.go.\n\t// The flag library's auto-generate help message isn't pretty enough.\n\n\taddrlist := Arglist(make([]string, 0, 1)) // pre-reserve for 1 address\n\tflag.Var(&addrlist, \"address\", \"Interfaces to bind to (e.g. 127.0.0.1 or [::1]).\")\n\n\t// server config options","sourceCodeStart":220,"sourceCodeEnd":256,"githubUrl":"https://github.com/joewalnes/websocketd/blob/7a8683dc7f9778dc615945aaed2a8dc77290227b/config.go#L220-L256","documentation":"validateDir is the generic check applied to other directory options (label names which one, e.g. the static or CGI directory); it stats the path and fails when it is missing or not a directory. Like the script-dir checks it runs during parseCommandLine, so a bad path aborts startup before the server listens.","triggerScenarios":"Passing --static or --cgi (whichever label appears in the message) pointing at a nonexistent path, a regular file, or a path the user cannot stat (permission denied on a parent directory).","commonSituations":"Deploy configs referencing asset directories not copied into the container; typos in flag values; permission-restricted directories (chmod 000 or missing execute bit on a parent); pointing the flag at a tarball/file instead of the extracted directory.","solutions":["Check the path: `ls -ld <dir>` — confirm it exists and is a directory (the message's %s tells you which flag is wrong)","Fix permissions so the websocketd user can access it (execute bit on all parent dirs, read on the dir itself)","Correct the flag value in your deploy config/manifest to the real directory path"],"exampleFix":"// before\nwebsocketd --dir=./scripts --static=./pubic --port=8080\n// after\nwebsocketd --dir=./scripts --static=./public --port=8080","handlingStrategy":"validation","validationCode":"for _, d := range map[string]string{\"--static\": staticDir, \"--cgi\": cgiDir} {\n\tif d == \"--\" { continue }\n\tif inf, err := os.Stat(d); err != nil || !inf.IsDir() {\n\t\tlog.Fatalf(\"%s not an accessible directory\", d)\n\t}\n}","typeGuard":null,"tryCatchPattern":"out, err := exec.Command(\"websocketd\", flags...).CombinedOutput()\nif err != nil && strings.Contains(string(out), \"is not pointing to an accessible directory\") {\n\t// inspect the named path: missing, file, or permission problem\n}","preventionTips":["Pre-check every directory flag with os.Stat + IsDir before launch","Ensure the service user has execute permission on all parent directories","In containers, copy/extract asset dirs and verify them in the entrypoint"],"tags":["cli","filesystem","directory","permissions"],"backgroundTag":"directory-not-accessible","analyzedSha":"7a8683dc7f9778dc615945aaed2a8dc77290227b","analyzedAt":"2026-09-03T13:52:22.309Z","contentChangedAt":"2026-09-03T13:52:22.309Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}