sipeed/picoclaw · error

Failed to reset config: %v

Error message

Failed to reset config: %v

What it means

Error "Failed to reset config: %v" thrown in sipeed/picoclaw.

Source

Thrown at web/backend/api/config.go:239

	if err := config.SaveConfig(h.configPath, &newCfg); err != nil {
		http.Error(w, fmt.Sprintf("Failed to save config: %v", err), http.StatusInternalServerError)
		return
	}

	h.applyRuntimeLogLevel()
	logger.Infof("configuration updated successfully")

	w.Header().Set("Content-Type", "application/json")
	json.NewEncoder(w).Encode(map[string]string{"status": "ok"})
}

// handleResetConfig resets the configuration to factory defaults.
// API keys and security credentials are preserved.
//
//	POST /api/config/reset
func (h *Handler) handleResetConfig(w http.ResponseWriter, r *http.Request) {
	if err := config.ResetToDefaults(h.configPath); err != nil {
		http.Error(w, fmt.Sprintf("Failed to reset config: %v", err), http.StatusInternalServerError)
		return
	}

	h.applyRuntimeLogLevel()
	logger.Infof("configuration reset to factory defaults")

	// Restart gateway if running
	status := h.gatewayStatusData()
	gatewayStatus, _ := status["gateway_status"].(string)
	if gatewayStatus == "running" {
		if _, err := h.RestartGateway(); err != nil {
			logger.ErrorF("failed to restart gateway after config reset", map[string]any{"error": err.Error()})
		}
	}

	w.Header().Set("Content-Type", "application/json")
	json.NewEncoder(w).Encode(map[string]string{"status": "ok"})
}

View on GitHub (pinned to 49183d7e8d)

When it happens

Trigger: Thrown at web/backend/api/config.go:239 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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