sipeed/picoclaw · warning · errAutoStartUnsupported
autostart is not supported on this platform
Error message
autostart is not supported on this platform
What it means
Platform-capability error from the autostart module. setAutoStart (startup.go:119-135) switches on runtime.GOOS and returns this sentinel only in the default branch, i.e. on any OS other than darwin, linux, windows. PUT /api/system/autostart turns it into HTTP 400 (startup.go:62-66); notably GET /api/system/autostart never errors — it just reports supported:false.
Source
Thrown at web/backend/api/startup.go:32
)
const (
autoStartEntryName = "PicoClawLauncher"
launchAgentLabel = "io.picoclaw.launcher"
)
type autoStartRequest struct {
Enabled bool `json:"enabled"`
}
type autoStartResponse struct {
Enabled bool `json:"enabled"`
Supported bool `json:"supported"`
Platform string `json:"platform"`
Message string `json:"message,omitempty"`
}
var errAutoStartUnsupported = errors.New("autostart is not supported on this platform")
func (h *Handler) registerStartupRoutes(mux *http.ServeMux) {
mux.HandleFunc("GET /api/system/autostart", h.handleGetAutoStart)
mux.HandleFunc("PUT /api/system/autostart", h.handleSetAutoStart)
}
func (h *Handler) handleGetAutoStart(w http.ResponseWriter, r *http.Request) {
enabled, supported, message, err := h.getAutoStartStatus()
if err != nil {
http.Error(w, fmt.Sprintf("Failed to read startup setting: %v", err), http.StatusInternalServerError)
return
}
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(autoStartResponse{
Enabled: enabled,
Supported: supported,
Platform: runtime.GOOS,View on GitHub (pinned to 49183d7e8d)
Solutions
- Check GET /api/system/autostart and only show the toggle when the supported field is true
- Run the backend on darwin, linux, or windows where launch-at-login is implemented
- Hide or disable the autostart UI on unsupported platforms instead of sending the PUT
- If you need autostart elsewhere, implement a new GOOS case in setAutoStart rather than catching the error
Example fix
// before
await fetch(`${api}/api/system/autostart`, {method: 'PUT', body: JSON.stringify({enabled: true})});
// after
const st = await (await fetch(`${api}/api/system/autostart`)).json();
if (!st.supported) throw new Error(`autostart unsupported on ${st.platform}`);
await fetch(`${api}/api/system/autostart`, {method: 'PUT', body: JSON.stringify({enabled: true})}); Defensive patterns
Strategy: validation
Validate before calling
const st = await (await fetch(`${api}/api/system/autostart`)).json();
if (!st.supported) {
ui.hideAutoStartToggle(st.message); // e.g. on freebsd/other GOOS
return;
} Type guard
func isAutoStartUnsupported(err error) bool {
return errors.Is(err, errAutoStartUnsupported)
} Try / catch
if err := h.setAutoStart(req.Enabled); err != nil {
if errors.Is(err, errAutoStartUnsupported) {
http.Error(w, err.Error(), http.StatusBadRequest)
return
}
http.Error(w, fmt.Sprintf("Failed to update startup setting: %v", err), http.StatusInternalServerError)
} Prevention
- Gate the autostart UI on the GET endpoint's supported field
- Never assume launch-at-login works because GET succeeded — GET never errors, PUT does
- Cross-compile checks: add a build/startup smoke test on the target GOOS
- Add new platforms in setAutoStart's switch rather than catching the sentinel downstream
When it happens
Trigger: PUT /api/system/autostart with {"enabled":true|false} while running a binary built for GOOS=freebsd, openbsd, plan9, js/wasm, etc.
Common situations: Cross-compiling the backend to an exotic target; running in a scratch container with an unusual GOOS; frontend code that assumes the toggle works everywhere because GET succeeded.
Related errors
- Launch at login is not supported on this platform.
- feishu channel is not supported on 32-bit architectures (arm
- session not found
- session already completed
- must be in range 1-65535
AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15).
Data as JSON: /api/errors/ca3531b4ff71203a.
Report an issue: GitHub.