{"record":{"id":"d347c77792355a2f","repo":"Hmbown/CodeWhale","slug":"parallel-max-1000-items-per-call","errorCode":null,"errorMessage":"parallel(): max 1000 items per call","messagePattern":"parallel\\(\\): max 1000 items per call","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/workflow-js/src/vm.rs","lineNumber":1076,"sourceCode":"  };\n\n  globalThis.task = async (opts) => {\n    if (opts === null || typeof opts !== \"object\") {\n      throw new TypeError(\"task(): expected an options object\");\n    }\n    const envelope = JSON.parse(await hostTask(JSON.stringify(opts)));\n    if (envelope.error !== undefined) {\n      throw new Error(envelope.error);\n    }\n    return envelope.value;\n  };\n\n  globalThis.parallel = (thunks) => {\n    if (!Array.isArray(thunks)) {\n      throw new TypeError(\"parallel(): expected an array of thunks\");\n    }\n    if (thunks.length > MAX_ITEMS) {\n      throw new Error(\"parallel(): max \" + MAX_ITEMS + \" items per call\");\n    }\n    return Promise.all(thunks.map((thunk) => {\n      try {\n        return Promise.resolve(typeof thunk === \"function\" ? thunk() : thunk).catch((err) => {\n          if (isFatalTaskError(err)) throw err;\n          hostLog(\"parallel(): dropped a failed slot as null: \" + String((err && err.message) || err));\n          return null;\n        });\n      } catch (err) {\n        if (isFatalTaskError(err)) return Promise.reject(err);\n        hostLog(\"parallel(): dropped a failed slot as null: \" + String((err && err.message) || err));\n        return null;\n      }\n    }));\n  };\n\n  globalThis.pipeline = (items, ...stages) => {\n    if (!Array.isArray(items)) {","sourceCodeStart":1058,"sourceCodeEnd":1094,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/0c42157ee52f9d55af2b506d71b46249910f77d3/crates/workflow-js/src/vm.rs#L1058-L1094","documentation":"Raised when releasing root-level approval policy fails: config_persistence::persist_unset_root_key could not remove the approval_policy key from the active config.toml. The code restores the previous permission_posture in TUI settings and, if saving those settings also fails, appends '; settings rollback also failed'. The failed outcome is returned as RootPostureOutcome::Failed and surfaces to the UI as Err(reason).","triggerScenarios":"Toggling root permission posture when the active config.toml is unwritable (owned by another user, read-only mount, system location), unparseable for round-tripping, or locked by another process.","commonSituations":"config.toml edited with sudo and now root-owned; config on a read-only mount; a second codewhale instance rewriting config.toml concurrently; syntax errors left by manual edits breaking round-trip.","solutions":["Fix write permissions on the active config.toml (chown/chmod to the running user) and retry the posture toggle","Manually delete the approval_policy key from config.toml if the automatic unset keeps failing","Verify config.toml parses cleanly before retrying; repair manual edits","If the rollback note is present, re-read settings.toml - the stored posture may not match the pre-toggle value"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before toggling root posture, confirm the active config.toml is writable.\nif let Some(path) = active_config_path {\n    let meta = std::fs::metadata(path)?;\n    anyhow::ensure!(!meta.permissions().readonly(), \"config.toml is read-only\");\n    // also confirm the process uid can write it, not just the readonly bit\n}","typeGuard":null,"tryCatchPattern":"// The toggle returns Err(String) on failure. If the message contains\n// 'rollback also failed', settings.toml may hold a posture that never took effect -\n// re-read it from disk before trusting the UI state.\nif let Err(reason) = app.set_root_posture(target) {\n    if reason.contains(\"rollback also failed\") {\n        app.reload_settings_from_disk();\n    }\n    show_error(reason);\n}","preventionTips":["Keep config.toml owned by the running user","Avoid concurrent codewhale instances editing config during posture toggles","Validate config.toml parses after every manual edit"],"tags":["config","permissions","approval-policy","settings"],"backgroundTag":"config-write-failed","analyzedSha":"0c42157ee52f9d55af2b506d71b46249910f77d3","analyzedAt":"2026-08-20T21:50:45.477Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}