vectordotdev/vector · critical

Failed to set socket permissions

Error message

Failed to set socket permissions

What it means

After successfully binding the Unix datagram socket, the source applies the configured socket_file_mode via change_socket_permissions and .expect()s success. Failure panics with "Failed to set socket permissions", meaning chmod on the socket file failed, usually due to filesystem permissions or an unsupported filesystem.

Solutions

  1. Run Vector as a user that owns the socket file's directory, or pre-create the directory with correct ownership
  2. Set a valid socket_file_mode in the source config (e.g. 0o666) or remove it to use defaults
  3. Move the socket path to a local filesystem (not NFS) that supports chmod
  4. Grant write/ownership rights on the parent directory instead of loosening global permissions

Example fix

// before
chown root:root /var/run/vector-sock
// after
chown vector:vector /var/run/vector-sock && chmod 770 /var/run/vector-sock
Defensive patterns

Strategy: validation

Validate before calling

install -d -o vector -g vector /var/run/vector && echo dir-ready

Prevention

When it happens

Trigger: The socket file lives on a filesystem that does not support permission changes or the Vector process lacks ownership of the socket path (e.g. socket created in a root-owned directory); socket_file_mode configured to an invalid mode value.

Common situations: Non-root Vector writing to /var/run with restrictive umask; container volumes mounted with restrictive options; NFS or tmpfs oddities; misconfigured socket_file_mode in the source config.

Understand the failure class

Background: "Permission denied" / "Failed to write" file errors: why a library can't write its files to disk (EACCES, EPERM, ENOSPC) and how to fix them — this error's family across 43 libraries.

Related errors


AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16). Data as JSON: /api/errors/d80be8fa2e350bf8. Report an issue: GitHub.

Appendix: source

Thrown at src/sources/util/unix_datagram.rs:46

/// Returns a `Source` object corresponding to a Unix domain datagram socket.
/// Passing in different functions for `decoder` and `handle_events` can allow
/// for different source-specific logic (such as decoding syslog messages in the
/// syslog source).
pub fn build_unix_datagram_source(
    listen_path: PathBuf,
    socket_file_mode: Option<u32>,
    max_length: usize,
    decoder: Decoder,
    handle_events: impl Fn(&mut [Event], Option<Bytes>) + Clone + Send + Sync + 'static,
    shutdown: ShutdownSignal,
    out: SourceSender,
) -> crate::Result<Source> {
    Ok(Box::pin(async move {
        let socket = UnixDatagram::bind(&listen_path).expect("Failed to bind to datagram socket");
        info!(message = "Listening.", path = ?listen_path, r#type = "unix_datagram");

        change_socket_permissions(&listen_path, socket_file_mode)
            .expect("Failed to set socket permissions");

        let result = listen(socket, max_length, decoder, shutdown, handle_events, out).await;

        // Delete socket file.
        if let Err(error) = remove_file(&listen_path) {
            emit!(UnixSocketFileDeleteError {
                path: &listen_path,
                error
            });
        }

        result
    }))
}

async fn listen(
    socket: UnixDatagram,
    max_length: usize,

View on GitHub (pinned to bdb87aeaa4)