{"record":{"id":"0b61c1038b40e70c","repo":"kovidgoyal/kitty","slug":"failed-to-create-shm-file-with-error-w","errorCode":null,"errorMessage":"Failed to create SHM file with error: %w","messagePattern":"Failed to create SHM file with error: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kittens/ssh/askpass.go","lineNumber":132,"sourceCode":"\t\t\t\t\t\tfmt.Println(code)\n\t\t\t\t\t\treturn 0\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tq := map[string]any{\n\t\t\"message\":     msg,\n\t\t\"type\":        q_type,\n\t\t\"is_password\": !is_fingerprint_check,\n\t}\n\tdata, err := json.Marshal(q)\n\tif err != nil {\n\t\treturn fatal(err)\n\t}\n\tdata_shm, err := shm.CreateTemp(\"askpass-*\", uint64(len(data)+32))\n\tif err != nil {\n\t\treturn fatal(fmt.Errorf(\"Failed to create SHM file with error: %w\", err))\n\t}\n\tdefer data_shm.Close()\n\tdefer func() { _ = data_shm.Unlink() }()\n\n\tdata_shm.Slice()[0] = 0\n\tif err = shm.WriteWithSize(data_shm, data, 1); err != nil {\n\t\treturn fatal(fmt.Errorf(\"Failed to write to SHM file with error: %w\", err))\n\t}\n\tif err = data_shm.Flush(); err != nil {\n\t\treturn fatal(fmt.Errorf(\"Failed to flush SHM file with error: %w\", err))\n\t}\n\ttrigger_ask(data_shm.Name())\n\tfor {\n\t\ttime.Sleep(50 * time.Millisecond)\n\t\tif data_shm.Slice()[0] == 1 {\n\t\t\tbreak\n\t\t}\n\t}","sourceCodeStart":114,"sourceCodeEnd":150,"githubUrl":"https://github.com/kovidgoyal/kitty/blob/6d5d0c440603ad9bdf6dcd599f73f6dde21acb44/kittens/ssh/askpass.go#L114-L150","documentation":"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.","triggerScenarios":"Running the ssh kitten askpass helper in an environment where POSIX shared memory is missing: containers without /dev/shm, restricted sandboxes, or tmpfs full.","commonSituations":"Docker containers with a tiny or absent /dev/shm, chroots, systems with noexec/ro /dev/shm mounts.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if st, err := os.Stat(\"/dev/shm\"); err != nil || !st.IsDir() { /* fail early with clear message */ }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Ensure /dev/shm tmpfs is mounted and writable in containers","Set adequate --shm-size in Docker","Fail fast on restricted sandboxes"],"tags":["shared-memory","shm","environment","ssh","askpass"],"backgroundTag":"shared-memory-unavailable","analyzedSha":"6d5d0c440603ad9bdf6dcd599f73f6dde21acb44","analyzedAt":"2026-08-27T14:20:20.142Z","schemaVersion":2},"datasetVersion":"2026-08-27T19:17:21.184Z"}