Hmbown/CodeWhale · error · Error
parallel(): max 1000 items per call
Error message
parallel(): max 1000 items per call
What it means
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).
Source
Thrown at crates/workflow-js/src/vm.rs:1076
};
globalThis.task = async (opts) => {
if (opts === null || typeof opts !== "object") {
throw new TypeError("task(): expected an options object");
}
const envelope = JSON.parse(await hostTask(JSON.stringify(opts)));
if (envelope.error !== undefined) {
throw new Error(envelope.error);
}
return envelope.value;
};
globalThis.parallel = (thunks) => {
if (!Array.isArray(thunks)) {
throw new TypeError("parallel(): expected an array of thunks");
}
if (thunks.length > MAX_ITEMS) {
throw new Error("parallel(): max " + MAX_ITEMS + " items per call");
}
return Promise.all(thunks.map((thunk) => {
try {
return Promise.resolve(typeof thunk === "function" ? thunk() : thunk).catch((err) => {
if (isFatalTaskError(err)) throw err;
hostLog("parallel(): dropped a failed slot as null: " + String((err && err.message) || err));
return null;
});
} catch (err) {
if (isFatalTaskError(err)) return Promise.reject(err);
hostLog("parallel(): dropped a failed slot as null: " + String((err && err.message) || err));
return null;
}
}));
};
globalThis.pipeline = (items, ...stages) => {
if (!Array.isArray(items)) {View on GitHub (pinned to 0c42157ee5)
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
Defensive patterns
Strategy: try-catch
Validate before calling
// Before toggling root posture, confirm the active config.toml is writable.
if let Some(path) = active_config_path {
let meta = std::fs::metadata(path)?;
anyhow::ensure!(!meta.permissions().readonly(), "config.toml is read-only");
// also confirm the process uid can write it, not just the readonly bit
} Try / catch
// The toggle returns Err(String) on failure. If the message contains
// 'rollback also failed', settings.toml may hold a posture that never took effect -
// re-read it from disk before trusting the UI state.
if let Err(reason) = app.set_root_posture(target) {
if reason.contains("rollback also failed") {
app.reload_settings_from_disk();
}
show_error(reason);
} Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- Invalid auto_review.allow[{index}].action_kind '{action_kind
- Invalid approval_policy '{policy}': expected on-request, unt
- approval_policy '{policy}' is not allowed by requirements ({
- permission posture 'never' is not part of the Runtime produc
- failed to parse permissions at {}; file contents were omitte
AI-assisted analysis of Hmbown/CodeWhale@0c42157ee5 (2026-08-20).
Data as JSON: /api/errors/d347c77792355a2f.
Report an issue: GitHub.