sipeed/picoclaw · critical
error in open panic: %v
Error message
error in open panic: %v
What it means
Startup panic in the unix build of logger.InitPanic: initPanicFile could not os.OpenFile the panic log (default <picoclaw home>/logs/launcher_panic.log) with O_WRONLY|O_CREATE|O_APPEND|O_SYNC, mode 0600. Because this file is the designated crash-output destination, failure to create it is fatal — the process aborts immediately, before logging is initialized.
Source
Thrown at pkg/logger/panic_unix.go:16
//go:build !windows
package logger
import (
"fmt"
"io"
"os"
"golang.org/x/sys/unix"
)
func initPanicFile(panicFile string) io.WriteCloser {
file, err := os.OpenFile(panicFile, os.O_WRONLY|os.O_CREATE|os.O_APPEND|os.O_SYNC, 0o600)
if err != nil {
panic(fmt.Sprintf("error in open panic: %v", err))
}
if err = unix.Dup2(int(file.Fd()), int(os.Stderr.Fd())); err != nil {
panic(fmt.Sprintf("error in syscall.Dup2: %v", err))
}
return file
}
View on GitHub (pinned to 49183d7e8d)
Solutions
- Read the %v in the panic text — the errno distinguishes permission denied, read-only file system, and no space left on device
- Make the logs directory writable by the service user (mkdir -p + chown/chmod)
- In containers, mount a writable volume at the logs path or point PICO_HOME at a writable directory
- Free space or raise quota if the errno is ENOSPC
Example fix
# before PICO_HOME=/opt/picoclaw ./launcher # not writable by app user # after PICO_HOME=/var/lib/picoclaw ./launcher # writable by app user
Defensive patterns
Strategy: validation
Validate before calling
dir := filepath.Join(utils.GetPicoclawHome(), "logs")
if err := os.MkdirAll(dir, 0o755); err != nil {
return fmt.Errorf("log dir %s unusable: %w", dir, err)
}
if err := unix.Access(dir, unix.W_OK); err != nil {
return fmt.Errorf("log dir %s not writable: %w", dir, err)
} Try / catch
The panic fires before in-process error handling is usable; catch it at the supervisor level: a fast startup exit with this message is a permissions/config incident — surface the text and fail the deploy.
Prevention
- Run a preflight writability check on the home/logs dir before InitPanic
- Bake correct ownership into container images or systemd RuntimeDirectory
- Never point PICO_HOME at read-only paths
When it happens
Trigger: The home/logs directory is not writable by the runtime user: permission denied, read-only root filesystem/container, a path component that is a regular file, disk full/quota exceeded, or a directory previously created by root with 0700 now used by an unprivileged user.
Common situations: Containers with read-only FS missing a writable volume mount; first run as a different user after root created the home; PICO_HOME pointing at an invalid path; SELinux/AppArmor denials.
Related errors
- error initializing panic log: %v
- error in syscall.Dup2: %v
- error in open panic: %v
- error enabling file logging: %v
- create session store dir: %w
AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15).
Data as JSON: /api/errors/776baa20da5aa7f0.
Report an issue: GitHub.