HKUDS/nanobot · error · ValueError

unix_socket_path must be an absolute path

Error message

unix_socket_path must be an absolute path

What it means

In WebSocketConfig.unix_socket_path_format, the configured unix_socket_path is non-empty but not absolute after expanduser (e.g. 'nanobot.sock' or 'run/x.sock'). Unix domain sockets must be addressed by an absolute filesystem path, so validation rejects relative paths.

Solutions

  1. Prefix the path with '/' (e.g. /home/user/.nanobot/nanobot.sock)
  2. Use ~ paths; expanduser is applied, so '~/run/nanobot.sock' is valid
  3. Leave unix_socket_path empty to listen on TCP host/port instead
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at nanobot/channels/websocket/runtime.py:233 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of HKUDS/nanobot@42f37dc4c0 (2026-08-26). Data as JSON: /api/errors/c891055f46a6523a. Report an issue: GitHub.

Appendix: source

Thrown at nanobot/channels/websocket/runtime.py:233

    # (base64 overhead) + envelope framing stays under 36 MB; the 40 MB ceiling
    # leaves a small margin for sender slop without opening a DoS avenue.
    max_message_bytes: int = Field(default=37_748_736, ge=1024, le=41_943_040)
    ping_interval_s: float = Field(default=20.0, ge=5.0, le=300.0)
    ping_timeout_s: float = Field(default=20.0, ge=5.0, le=300.0)
    ssl_certfile: str = ""
    ssl_keyfile: str = ""

    @field_validator("unix_socket_path")
    @classmethod
    def unix_socket_path_format(cls, value: str) -> str:
        value = value.strip()
        if not value:
            return ""
        if "\x00" in value:
            raise ValueError("unix_socket_path must not contain NUL bytes")
        path = Path(value).expanduser()
        if not path.is_absolute():
            raise ValueError("unix_socket_path must be an absolute path")
        return str(path)

    @field_validator("path")
    @classmethod
    def path_must_start_with_slash(cls, value: str) -> str:
        if not value.startswith("/"):
            raise ValueError('path must start with "/"')
        return _normalize_config_path(value)

    @field_validator("token_issue_path")
    @classmethod
    def token_issue_path_format(cls, value: str) -> str:
        value = value.strip()
        if not value:
            return ""
        if not value.startswith("/"):
            raise ValueError('token_issue_path must start with "/"')
        return _normalize_config_path(value)

View on GitHub (pinned to 42f37dc4c0)