kovidgoyal/kitty · error
Failed to create SHM file with error: %w
Error message
Failed to create SHM file with error: %w
What it means
RunSSHAskpass serializes the askpass request into shared memory using shm.CreateTemp('askpass-*'). If CreateTemp fails (typically /dev/shm unavailable or not writable), this fatal error is returned.
Source
Thrown at kittens/ssh/askpass.go:132
fmt.Println(code)
return 0
}
}
}
}
}
q := map[string]any{
"message": msg,
"type": q_type,
"is_password": !is_fingerprint_check,
}
data, err := json.Marshal(q)
if err != nil {
return fatal(err)
}
data_shm, err := shm.CreateTemp("askpass-*", uint64(len(data)+32))
if err != nil {
return fatal(fmt.Errorf("Failed to create SHM file with error: %w", err))
}
defer data_shm.Close()
defer func() { _ = data_shm.Unlink() }()
data_shm.Slice()[0] = 0
if err = shm.WriteWithSize(data_shm, data, 1); err != nil {
return fatal(fmt.Errorf("Failed to write to SHM file with error: %w", err))
}
if err = data_shm.Flush(); err != nil {
return fatal(fmt.Errorf("Failed to flush SHM file with error: %w", err))
}
trigger_ask(data_shm.Name())
for {
time.Sleep(50 * time.Millisecond)
if data_shm.Slice()[0] == 1 {
break
}
}View on GitHub (pinned to 6d5d0c4406)
Solutions
- Ensure /dev/shm exists and is writable (mount tmpfs on it)
- Increase /dev/shm size (docker --shm-size)
- Free space if /dev/shm tmpfs is full
- Avoid running the ssh kitten askpass inside restricted sandboxes
Defensive patterns
Strategy: validation
Validate before calling
if st, err := os.Stat("/dev/shm"); err != nil || !st.IsDir() { /* fail early with clear message */ } Prevention
- Ensure /dev/shm tmpfs is mounted and writable in containers
- Set adequate --shm-size in Docker
- Fail fast on restricted sandboxes
When it happens
Trigger: Running the ssh kitten askpass helper in an environment where POSIX shared memory is missing: containers without /dev/shm, restricted sandboxes, or tmpfs full.
Common situations: Docker containers with a tiny or absent /dev/shm, chroots, systems with noexec/ro /dev/shm mounts.
Related errors
- Failed to write to SHM file with error: %w
- Failed to flush SHM file with error: %w
- Failed to read from SHM file with error: %w
- Failed to parse response data: %#v with error: %w
- Incorrect owner on pwfile: uid={shm.stats.st_uid} gid={shm.s
AI-assisted analysis of kovidgoyal/kitty@6d5d0c4406 (2026-08-27).
Data as JSON: /api/errors/0b61c1038b40e70c.
Report an issue: GitHub.