{"record":{"id":"167fc431bed2c338","repo":"santifer/career-ops","slug":"all-loaded-models-have-been-blacklisted-this-sessi","errorCode":null,"errorMessage":"All loaded models have been blacklisted this session.","messagePattern":"All loaded models have been blacklisted this session\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"openrouter-runner.mjs","lineNumber":263,"sourceCode":"    } catch (e) {\n      if (e.name === 'AbortError') throw new Error(`Pinned model timed out after ${MODEL_TIMEOUT_MS / 1000}s`);\n      throw e;\n    } finally {\n      clearTimeout(timerId);\n    }\n  }\n\n  const models = await loadFreeModels();\n  let lastError;\n\n  if (models.length === 0) {\n    throw new Error(\n      'No free OpenRouter models are available. Model loading may have failed, or your account currently has no free models.'\n    );\n  }\n  // Build the active (non-blacklisted) model list in rotation order\n  const active = models.filter(m => !blacklistedModels.has(m));\n  if (active.length === 0) throw new Error('All loaded models have been blacklisted this session.');\n\n  for (let attempt = 0; attempt < active.length; attempt++) {\n    const model = active[(modelIndex % active.length + attempt) % active.length];\n    activeModel = model;\n    process.stdout.write(`[model] ${model} ... `);\n\n    try {\n      const body = JSON.stringify({\n        model,\n        messages: [\n          buildCachedSystemMessage(systemPrompt),\n          { role: 'user', content: userMessage },\n        ],\n        max_tokens: MAX_TOKENS,\n      });\n\n      const controller = new AbortController();\n      const timerId = setTimeout(() => controller.abort(), MODEL_TIMEOUT_MS);","sourceCodeStart":245,"sourceCodeEnd":281,"githubUrl":"https://github.com/santifer/career-ops/blob/9b17a8ac97b398a496b38e423ae24e433b43254f/openrouter-runner.mjs#L245-L281","documentation":"Thrown by callOpenRouter() when the free-model list loaded successfully but every model in it has been added to the session blacklist (blacklistedModels Set). Blacklisting happens during rotation when a model persistently fails (e.g. repeated 429), so once all loaded models are blacklisted there is nothing left to try and the runner gives up for this session. The blacklist is persisted across runs via loadPersistedBlacklist().","triggerScenarios":"models.length > 0, but active = models.filter(m => !blacklistedModels.has(m)) is empty — every model was blacklisted earlier in the session (or loaded from the persisted blacklist file). The `if (active.length === 0)` guard throws.","commonSituations":"A prior session blacklisted all models due to a transient network issue and the blacklist persisted; aggressive 429s from hitting OpenRouter too hard blacklisted everything; stale persisted blacklist file from an old outage.","solutions":["Clear the persisted blacklist file so blacklistedModels starts empty next run (check where loadPersistedBlacklist reads).","Wait if the blacklisting was due to rate-limiting (429s), then retry so models get a fresh chance.","Pin a specific model via CAREER_OPS_MODEL to bypass rotation entirely.","Investigate why all models failed — if it was a network/key issue, fix that root cause so the next run doesn't re-blacklist."],"exampleFix":"# before — all models blacklisted from a prior outage\nnode openrunner-runner.mjs ...\n# throws: All loaded models have been blacklisted this session.\n\n# after — clear persisted blacklist and/or pin a model\nrm ~/.career-ops/blacklist.json   # or wherever loadPersistedBlacklist reads\n# or\nexport CAREER_OPS_MODEL=google/gemini-2.0-flash-exp:free","handlingStrategy":"validation","validationCode":"// Clear a stale persisted blacklist before the run if appropriate\nconst fs = require('fs');\nconst blPath = require('os').homedir() + '/.career-ops/blacklist.json';\nif (fs.existsSync(blPath)) fs.unlinkSync(blPath); // only if you accept the tradeoff","typeGuard":null,"tryCatchPattern":"try {\n  return await callOpenRouter(systemPrompt, userMessage);\n} catch (e) {\n  if (e.message === 'All loaded models have been blacklisted this session.') {\n    // clear persisted blacklist and retry once\n    clearPersistedBlacklist();\n    return await callOpenRouter(systemPrompt, userMessage);\n  }\n  throw e;\n}","preventionTips":["Clear the persisted blacklist when a prior outage (not model fault) caused mass blacklisting.","Fix root causes (key/network) before retrying so models aren't re-blacklisted.","Pin CAREER_OPS_MODEL to bypass rotation when the blacklist is exhausted.","Reduce request rate to avoid 429-driven blacklisting."],"tags":["openrouter","model-rotation","blacklist","rate-limit","configuration"],"backgroundTag":null,"analyzedSha":"9b17a8ac97b398a496b38e423ae24e433b43254f","analyzedAt":"2026-08-13T00:48:39.135Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}