joewalnes/websocketd · error

your %s '%s' is not pointing to an accessible directory

Error message

your %s '%s' is not pointing to an accessible directory

What it means

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.

Source

Thrown at config.go:238

	}
	inf, err := os.Stat(absDir)
	if err != nil {
		return "", fmt.Errorf("could not find your script dir '%s'", dir)
	}
	if !inf.IsDir() {
		return "", fmt.Errorf("did you mean to specify COMMAND instead of --dir '%s'?", dir)
	}
	return absDir, nil
}

// validateDir checks that a directory path exists and is a directory.
func validateDir(dir, label string) error {
	if dir == "" {
		return nil
	}
	inf, err := os.Stat(dir)
	if err != nil || !inf.IsDir() {
		return fmt.Errorf("your %s '%s' is not pointing to an accessible directory", label, dir)
	}
	return nil
}

func parseCommandLine() *Config {
	var mainConfig Config
	var config libwebsocketd.Config

	flag.CommandLine = flag.NewFlagSet(os.Args[0], flag.ContinueOnError)
	flag.CommandLine.Usage = func() {}

	// If adding new command line options, also update the help text in help.go.
	// The flag library's auto-generate help message isn't pretty enough.

	addrlist := Arglist(make([]string, 0, 1)) // pre-reserve for 1 address
	flag.Var(&addrlist, "address", "Interfaces to bind to (e.g. 127.0.0.1 or [::1]).")

	// server config options

View on GitHub (pinned to 7a8683dc7f)

Solutions

  1. Check the path: `ls -ld <dir>` — confirm it exists and is a directory (the message's %s tells you which flag is wrong)
  2. Fix permissions so the websocketd user can access it (execute bit on all parent dirs, read on the dir itself)
  3. Correct the flag value in your deploy config/manifest to the real directory path

Example fix

// before
websocketd --dir=./scripts --static=./pubic --port=8080
// after
websocketd --dir=./scripts --static=./public --port=8080
Defensive patterns

Strategy: validation

Validate before calling

for _, d := range map[string]string{"--static": staticDir, "--cgi": cgiDir} {
	if d == "--" { continue }
	if inf, err := os.Stat(d); err != nil || !inf.IsDir() {
		log.Fatalf("%s not an accessible directory", d)
	}
}

Try / catch

out, err := exec.Command("websocketd", flags...).CombinedOutput()
if err != nil && strings.Contains(string(out), "is not pointing to an accessible directory") {
	// inspect the named path: missing, file, or permission problem
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of joewalnes/websocketd@7a8683dc7f (2026-09-03). Data as JSON: /api/errors/91276e5c670762b4. Report an issue: GitHub.