sipeed/picoclaw · critical

error enabling file logging: %v

Error message

error enabling file logging: %v

What it means

Launcher main() panics when logger.EnableFileLogging(<picoclaw home>/logs/launcher.log) fails during file-logging setup, which runs in GUI mode or with -debug. This is the general launcher log (distinct from the panic log); failure means the launcher cannot persist its own logs, which is treated as fatal because GUI runs would otherwise be undiagnosable.

Source

Thrown at web/backend/main.go:457

	f := filepath.Join(picoHome, logPath, panicFile)
	panicFunc, err := logger.InitPanic(f)
	if err != nil {
		panic(fmt.Sprintf("error initializing panic log: %v", err))
	}
	defer panicFunc()

	enableConsole := *console
	fileLoggingEnabled := shouldEnableLauncherFileLogging(enableConsole, debug)
	if fileLoggingEnabled {
		// GUI mode writes launcher logs to file. Debug mode keeps file logging enabled in console mode too.
		if !debug {
			logger.DisableConsole()
		}

		f := filepath.Join(picoHome, logPath, logFile)
		if err = logger.EnableFileLogging(f); err != nil {
			panic(fmt.Sprintf("error enabling file logging: %v", err))
		}
		defer logger.DisableFileLogging()
	}
	if debug {
		logger.SetLevel(logger.DEBUG)
	}

	// Set language from command line or auto-detect
	if *lang != "" {
		SetLanguage(*lang)
	}

	// Resolve config path
	configPath := utils.GetDefaultConfigPath()
	if flag.NArg() > 0 {
		configPath = flag.Arg(0)
	}

View on GitHub (pinned to 49183d7e8d)

Solutions

  1. Close programs holding launcher.log and ensure no second launcher instance is running
  2. Apply the same writability fixes as for the panic log (PICO_HOME, ownership, volume mounts)
  3. Free disk space if the errno indicates no space left
  4. As a diagnostic workaround, run with -console (file logging disabled when not in debug) to see logs on screen

Example fix

# before: two GUI instances share one home
# after: one instance per home / per-user home
PICO_HOME=%LOCALAPPDATA%\Picoclaw-%USERNAME%
Defensive patterns

Strategy: validation

Validate before calling

logFile := filepath.Join(utils.GetPicoclawHome(), "logs", "launcher.log")
if probe, err := os.OpenFile(logFile, os.O_WRONLY|os.O_CREATE|os.O_APPEND, 0o644); err != nil {
    return fmt.Errorf("launcher.log not writable: %w", err)
} else {
    probe.Close()
}

Try / catch

Startup panic: the process dies before normal error handling. Handle at the supervisor level — fail the launch, show the wrapped error (lock vs permission vs disk-full), and retry only after the blocker is cleared.

Prevention

When it happens

Trigger: launcher.log locked by another process (Windows share violation from a second instance, a log viewer, or an editor with exclusive lock); directory turned read-only after the panic log was created; disk full; permissions changed between runs.

Common situations: Double-launching the GUI app; keeping the log open in an editor that takes exclusive locks; home directory moved between runs; ENOSPC on the logs volume.

Related errors


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/35886c14783d00ea. Report an issue: GitHub.