{"record":{"id":"c9b28be89a920baa","repo":"ruvnet/ruflo","slug":"darwin-explicitly-requested-but-unavailable","errorCode":null,"errorMessage":"Darwin explicitly requested but unavailable","messagePattern":"Darwin explicitly requested but unavailable","errorType":"exception","errorClass":"DarwinUnavailableError","httpStatus":null,"severity":"error","filePath":"v3/@claude-flow/cli/src/services/flywheel-proposer.ts","lineNumber":196,"sourceCode":"}\n\nexport async function proposeFlywheelCandidates(input: ProposeCandidatesInput): Promise<CandidateArchive> {\n  const baselineRef = policyCandidateId(input.baselinePolicy);\n  const runLocal = async (substitution?: string) => finalizeArchive({\n    requested: input.mode,\n    effective: 'local',\n    substitution,\n    promotionAllowed: substitution ? input.allowSubstitutionPromotion === true : true,\n    baselineRef,\n    safetyEnvelope: input.safetyEnvelope,\n    seed: input.seed,\n    candidates: await input.localProposer(input.baselinePolicy, input.seed),\n    completed: true,\n  });\n\n  if (input.mode === 'local') return runLocal();\n  if (!input.darwinInvoker) {\n    if (input.mode === 'darwin') throw new DarwinUnavailableError('Darwin explicitly requested but unavailable');\n    return runLocal('darwin-unavailable');\n  }\n\n  try {\n    const maxWallTimeMs = input.maxWallTimeMs ?? 60_000;\n    let timeout: NodeJS.Timeout | undefined;\n    const result = await Promise.race([\n      input.darwinInvoker({\n        baselinePolicy: input.baselinePolicy,\n        seed: input.seed,\n        budget: {\n          maxEvaluationCostMicros: input.safetyEnvelope.maxEvaluationCostMicros,\n          maxConcurrency: input.maxConcurrency ?? 2,\n          maxWallTimeMs,\n        },\n      }),\n      new Promise<never>((_, reject) => {\n        timeout = setTimeout(() => reject(new DarwinUnavailableError('Darwin exceeded wall-time budget')), maxWallTimeMs);","sourceCodeStart":178,"sourceCodeEnd":214,"githubUrl":"https://github.com/ruvnet/ruflo/blob/6b01dc5a687b26b3e218f796de45ec51f8fa9e8c/v3/@claude-flow/cli/src/services/flywheel-proposer.ts#L178-L214","documentation":"proposeFlywheelCandidates with mode 'darwin' requires a darwinInvoker function in the input. When mode is 'darwin' but input.darwinInvoker is falsy, the proposer cannot reach Darwin and, because the caller demanded Darwin (no substitution allowed), it throws DarwinUnavailableError rather than silently substituting the local proposer.","triggerScenarios":"Calling proposeFlywheelCandidates({ mode: 'darwin', ... }) without providing darwinInvoker, or with darwinInvoker set to undefined/null because the Darwin backend is not configured in this environment.","commonSituations":"Darwin is gated behind a feature flag or license that is not enabled; the wiring code conditionally passes darwinInvoker only when a Darwin service URL is set, but the caller still requests mode 'darwin'; misconfiguration in a test that hard-codes mode 'darwin'.","solutions":["Provide a real darwinInvoker when requesting mode 'darwin'.","If Darwin is optional, use mode 'auto' or 'local' so the proposer falls back instead of throwing.","Gate the mode on darwinInvoker presence: mode: darwinInvoker ? 'darwin' : 'local'.","Configure/enable the Darwin backend before requesting darwin mode."],"exampleFix":"// before\nproposeFlywheelCandidates({ mode: 'darwin', baselinePolicy, safetyEnvelope, seed, localProposer }); // throws\n\n// after\nconst mode = darwinInvoker ? 'darwin' : 'local';\nproposeFlywheelCandidates({ mode, darwinInvoker, baselinePolicy, safetyEnvelope, seed, localProposer });","handlingStrategy":"validation","validationCode":"const mode = darwinInvoker ? 'darwin' : 'local';\nawait proposeFlywheelCandidates({ mode, darwinInvoker, baselinePolicy, safetyEnvelope, seed, localProposer });","typeGuard":"function hasDarwin(input: ProposeCandidatesInput): input is ProposeCandidatesInput & { darwinInvoker: NonNullable<ProposeCandidatesInput['darwinInvoker']> } {\n  return typeof input.darwinInvoker === 'function';\n}","tryCatchPattern":null,"preventionTips":["Only set mode 'darwin' when darwinInvoker is wired.","Use mode 'auto' when Darwin is optional so missing invokers fall back gracefully.","Compute mode from invoker presence rather than hard-coding it.","Enable/configure the Darwin backend before requesting darwin mode."],"tags":["darwin","flywheel","safety-envelope","typescript"],"backgroundTag":null,"analyzedSha":"6b01dc5a687b26b3e218f796de45ec51f8fa9e8c","analyzedAt":"2026-08-12T13:20:50.148Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}