{"record":{"id":"f4b5576a68bd4fa3","repo":"multica-ai/multica","slug":"invalid-desktop-runtime-config-field-must-be-a","errorCode":null,"errorMessage":"Invalid desktop runtime config: ${field} must be a non-empty string","messagePattern":"Invalid desktop runtime config: (.+?) must be a non-empty string","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"apps/desktop/src/shared/runtime-config.ts","lineNumber":129,"sourceCode":"}\n\n// Dev variant: when the api host is the local backend (`localhost:8080` /\n// `127.0.0.1:8080`), the renderer is served from a different port (3000),\n// so deriving by host alone is wrong. Fall back to the local dev web URL\n// in that case; for any non-local host (e.g. a remote test environment),\n// trust the production-style derivation so `apiUrl=https://api.test.x`\n// yields `appUrl=https://test.x` without a separate VITE_APP_URL.\nexport 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`);","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/apps/desktop/src/shared/runtime-config.ts#L111-L147","documentation":"Wrap thrown by execenv.Prepare when writeSidecarManifest cannot record the manifest of sidecar files written into the environment root. Its severity is conditional: when params.LocalWorkDir is set (in-place run into the user's own directory) the manifest is the ONLY record of what was written there, so losing it strands the sidecar tree permanently (issue MUL-6132) — Prepare fails so the registered rollback removes the tree now. Otherwise the manifest is a GC convenience and the error is only logged as a warning.","triggerScenarios":"writeSidecarManifest(envRoot, manifest) returns an error. It becomes this returned error only when params.LocalWorkDir != \"\" (in-place run); with an empty LocalWorkDir the same failure is downgraded to logger.Warn(\"execenv: write sidecar manifest failed (non-fatal)\").","commonSituations":"In-place task targeting a user directory on a read-only or full filesystem; transient disk/permission hiccup exactly between writing the sidecar tree and its manifest; a manifest path colliding with a directory.","solutions":["Verify the env-root (and, for in-place runs, the local work dir) is writable and has space for the manifest file.","If the failure is transient (NFS hiccup, disk momentarily full), free space and re-run the task — the rollback will have cleaned the stranded tree, so the retry starts clean.","Check for a stale directory or symlink occupying the manifest path and remove it.","If running in-place frequently, monitor disk health of the user directory; a manifest write failing there is the signal the sidecar rollback path also depends on."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"if params.LocalWorkDir != \"\" {\n    // in-place runs: manifest write is load-bearing, pre-check writability\n    if err := checkWritable(params.LocalWorkDir); err != nil {\n        return fmt.Errorf(\"local work dir not writable: %w\", err)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := execenv.Prepare(ctx, params); err != nil {\n    if strings.Contains(err.Error(), \"write sidecar manifest\") && params.LocalWorkDir != \"\" {\n        // rollback already ran; clean any residue, fix disk/perms, retry once\n    }\n}","preventionTips":["Treat in-place runs as privileged: verify target dir health before starting.","Disk-space alerts on user directories used for in-place runs.","Prefer non-in-place (env-root) runs where the manifest failure is only a warning."],"tags":["go","execenv","sidecar","manifest","filesystem","rollback"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}