{"record":{"id":"4dcf196bd66db5d6","repo":"multica-ai/multica","slug":"invalid-desktop-runtime-config-field-must-be-a-4dcf19","errorCode":null,"errorMessage":"Invalid desktop runtime config: ${field} must be a non-empty string when set","messagePattern":"Invalid desktop runtime config: (.+?) must be a non-empty string when set","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/desktop/src/shared/runtime-config.ts","lineNumber":137,"sourceCode":"export function deriveDevAppUrl(apiUrl: string): string {\n  const url = new URL(apiUrl);\n  if (url.hostname === \"localhost\" || url.hostname === \"127.0.0.1\") {\n    return LOCAL_DEV_RUNTIME_CONFIG.appUrl;\n  }\n  return deriveAppUrl(apiUrl);\n}\n\nfunction requiredString(value: unknown, field: string): string {\n  if (typeof value !== \"string\" || value.trim().length === 0) {\n    throw new Error(`Invalid desktop runtime config: ${field} must be a non-empty string`);\n  }\n  return value;\n}\n\nfunction optionalString(value: unknown, field: string): string | undefined {\n  if (value === undefined) return undefined;\n  if (typeof value !== \"string\" || value.trim().length === 0) {\n    throw new Error(`Invalid desktop runtime config: ${field} must be a non-empty string when set`);\n  }\n  return value;\n}\n\nfunction normalizeHttpUrl(value: string, field: string): string {\n  let url: URL;\n  try {\n    url = new URL(value.trim());\n  } catch {\n    throw new Error(`Invalid desktop runtime config: ${field} must be a valid URL`);\n  }\n  if (url.protocol !== \"http:\" && url.protocol !== \"https:\") {\n    throw new Error(`Invalid desktop runtime config: ${field} must use http or https`);\n  }\n  url.search = \"\";\n  url.hash = \"\";\n  return trimTrailingSlash(url.toString());\n}","sourceCodeStart":119,"sourceCodeEnd":155,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/apps/desktop/src/shared/runtime-config.ts#L119-L155","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Validate/repair the user's openclaw config (parse it locally, e.g. `openclaw config check` or a TOML parse) and re-run the task.","Confirm params.OpenclawBin points to an existing, executable openclaw binary of a compatible version.","Check write permissions and space under the task's env-root.","Do not attempt to bypass by stripping the user config — that would boot OpenClaw without its expected agents/providers/keys."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if params.Provider == \"openclaw\" {\n    if fi, err := os.Stat(params.OpenclawBin); err != nil || fi.IsDir() {\n        return fmt.Errorf(\"openclaw binary missing: %s\", params.OpenclawBin)\n    }\n    if err := validateOpenclawUserConfig(); err != nil { // e.g. TOML parse of user config\n        return fmt.Errorf(\"user openclaw config invalid: %w\", err)\n    }\n}","typeGuard":null,"tryCatchPattern":"env, err := execenv.Prepare(ctx, params)\nif err != nil && strings.Contains(err.Error(), \"prepare openclaw config\") {\n    // fail the task with a user-actionable message: repair config or binary; do NOT retry blindly\n}","preventionTips":["Parse-validate the user's openclaw config whenever it changes.","Verify the openclaw binary path/version at agent registration time.","Fail closed in your own wrappers too — never substitute a minimal config."],"tags":["go","execenv","openclaw","config","fail-closed"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}