multica-ai/multica · error · Error

Invalid desktop runtime config: ${field} must be a non-empty

Error message

Invalid desktop runtime config: ${field} must be a non-empty string when set

What it means

Wrap thrown by execenv.Prepare when prepareOpenclawConfig fails for an 'openclaw'-provider task. The daemon synthesizes a per-task config that pins the OpenClaw workspace to the task's workDir (the skill scanner then reads {workDir}/skills/). It deliberately fails CLOSED: a malformed user config the openclaw CLI cannot read is a real problem, and silently degrading to a minimal config would boot OpenClaw without the agents/providers/API keys it expects.

Source

Thrown at apps/desktop/src/shared/runtime-config.ts:137

export function deriveDevAppUrl(apiUrl: string): string {
  const url = new URL(apiUrl);
  if (url.hostname === "localhost" || url.hostname === "127.0.0.1") {
    return LOCAL_DEV_RUNTIME_CONFIG.appUrl;
  }
  return deriveAppUrl(apiUrl);
}

function requiredString(value: unknown, field: string): string {
  if (typeof value !== "string" || value.trim().length === 0) {
    throw new Error(`Invalid desktop runtime config: ${field} must be a non-empty string`);
  }
  return value;
}

function optionalString(value: unknown, field: string): string | undefined {
  if (value === undefined) return undefined;
  if (typeof value !== "string" || value.trim().length === 0) {
    throw new Error(`Invalid desktop runtime config: ${field} must be a non-empty string when set`);
  }
  return value;
}

function normalizeHttpUrl(value: string, field: string): string {
  let url: URL;
  try {
    url = new URL(value.trim());
  } catch {
    throw new Error(`Invalid desktop runtime config: ${field} must be a valid URL`);
  }
  if (url.protocol !== "http:" && url.protocol !== "https:") {
    throw new Error(`Invalid desktop runtime config: ${field} must use http or https`);
  }
  url.search = "";
  url.hash = "";
  return trimTrailingSlash(url.toString());
}

View on GitHub (pinned to 2c0912b6ec)

Solutions

  1. Validate/repair the user's openclaw config (parse it locally, e.g. `openclaw config check` or a TOML parse) and re-run the task.
  2. Confirm params.OpenclawBin points to an existing, executable openclaw binary of a compatible version.
  3. Check write permissions and space under the task's env-root.
  4. Do not attempt to bypass by stripping the user config — that would boot OpenClaw without its expected agents/providers/keys.
Defensive patterns

Strategy: validation

Validate before calling

if params.Provider == "openclaw" {
    if fi, err := os.Stat(params.OpenclawBin); err != nil || fi.IsDir() {
        return fmt.Errorf("openclaw binary missing: %s", params.OpenclawBin)
    }
    if err := validateOpenclawUserConfig(); err != nil { // e.g. TOML parse of user config
        return fmt.Errorf("user openclaw config invalid: %w", err)
    }
}

Try / catch

env, err := execenv.Prepare(ctx, params)
if err != nil && strings.Contains(err.Error(), "prepare openclaw config") {
    // fail the task with a user-actionable message: repair config or binary; do NOT retry blindly
}

Prevention

When it happens

Trigger: Prepare is called with params.Provider == "openclaw" and prepareOpenclawConfig returns an error — typically the user's openclaw config is malformed, OpenclawBin cannot be executed to derive the config, or the per-task config cannot be written under envRoot.

Common situations: User edited ~/.openclaw config into invalid TOML/JSON after the agent was registered; openclaw CLI binary missing or not on the path given by params.OpenclawBin after a version upgrade or uninstall; env-root not writable.

Related errors


AI-assisted analysis of multica-ai/multica@2c0912b6ec (2026-08-15). Data as JSON: /api/errors/4dcf196bd66db5d6. Report an issue: GitHub.