semaphoreui/semaphore · error

creating socket directory

Error message

creating socket directory: %w

What it means

Returned by Agent.Listen in pkg/ssh/agent.go when os.MkdirAll fails to create the parent directory of the SSH agent socket path. It fires on ordinary filesystem errors: the directory cannot be created because of permission denial, a path component is a file, the filesystem is read-only, or the TmpPath-derived location is otherwise invalid. The %w wraps the underlying os.PathError with the exact directory and errno.

Solutions

  1. Check the wrapped PathError for the failing directory and errno (EACCES, ENOTDIR, EROFS)
  2. Ensure the Semaphore process user owns or can write to the configured TmpPath where agent sockets are created
  3. Remove any regular file that occupies a path component of the intended socket directory
  4. If TmpPath points to a read-only or container-mounted volume, point it at a writable scratch directory
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/ssh/agent.go:63 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of semaphoreui/semaphore@1774ccb71a (2026-09-07). Data as JSON: /api/errors/fa2d9a793940fd76. Report an issue: GitHub.

Appendix: source

Thrown at pkg/ssh/agent.go:63

		if len(k.Passphrase) == 0 {
			key, err = ssh.ParseRawPrivateKey(k.Key)
		} else {
			key, err = ssh.ParseRawPrivateKeyWithPassphrase(k.Key, k.Passphrase)
		}

		if err != nil {
			return fmt.Errorf("parsing private key: %w", err)
		}

		if err := keyring.Add(agent.AddedKey{
			PrivateKey: key,
		}); err != nil {
			return fmt.Errorf("adding private key: %w", err)
		}
	}

	if err := os.MkdirAll(path.Dir(a.SocketFile), 0o755); err != nil {
		return fmt.Errorf("creating socket directory: %w", err)
	}

	l, err := net.ListenUnix(
		"unix",
		&net.UnixAddr{
			Net:  "unix",
			Name: a.SocketFile,
		},
	)
	if err != nil {
		return fmt.Errorf("listening on socket %q: %w", a.SocketFile, err)
	}

	l.SetUnlinkOnClose(true)
	a.listener = l
	a.done = make(chan struct{})

	go func() {

View on GitHub (pinned to 1774ccb71a)