{"record":{"id":"bcf62e8b59d2e858","repo":"mastra-ai/mastra","slug":"unsupported-provider-item","errorCode":"unsupported_provider_item","errorMessage":"Factory skill invocation requires one exclusive board stage.","messagePattern":"Factory skill invocation requires one exclusive board stage\\.","errorType":"error_code","errorClass":"FactoryDispatchError","httpStatus":null,"severity":"error","filePath":"mastracode/factory/src/routes/surface.ts","lineNumber":186,"sourceCode":" * default model. Exported for tests — this is the autonomous entry point with no\n * browser and no interactive user, so nothing else would catch a regression in\n * what it forwards.\n */\nexport async function prepareFactoryRuleBinding(\n  github: GithubIntegration,\n  coordinator: Pick<FactoryStartCoordinator, 'prepare'>,\n  projects: FactoryProjectsStorage,\n  input: FactoryBindingPreparationInput,\n): Promise<void> {\n  try {\n    const branch = workItemBranch({\n      id: input.item.id,\n      source: workItemBranchSource(input.item.externalSource),\n      metadata: input.item.metadata,\n    });\n    const destinationStage = factoryRuleStage(input.item.stages);\n    if (!destinationStage) {\n      throw new FactoryDispatchError(\n        'unsupported_provider_item',\n        'Factory skill invocation requires one exclusive board stage.',\n      );\n    }\n    const repositorySlug =\n      typeof input.item.metadata?.repository === 'string' ? input.item.metadata.repository : undefined;\n    const preparedSession = await ensureFactorySourceSession({\n      sourceControl: github.sourceControlStorage,\n      orgId: input.record.orgId,\n      factoryProjectId: input.record.factoryProjectId,\n      repositorySlug,\n      branch,\n      // A human-approved proposal has an interactive user: attribute the run to\n      // the approver, not the repo connector.\n      attributeToUserId: input.record.approvedBy ?? undefined,\n    });\n\n    await coordinator.prepare({","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/mastracode/factory/src/routes/surface.ts#L168-L204","documentation":"prepareFactoryRuleBinding maps an external work item to a factory skill invocation, and factoryRuleStage(item.stages) must yield exactly one board stage. When the item has zero or multiple stages (no exclusive stage), the binding cannot be dispatched deterministically, so a FactoryDispatchError with code 'unsupported_provider_item' is thrown.","triggerScenarios":"A provider webhook/rule fires for a work item whose stages array is empty or contains more than one stage; syncing items from a board where the card sits in multiple columns or none.","commonSituations":"Provider boards where items aren't assigned to a column yet (backlog-less items); misconfigured board rules attaching multiple stage labels; provider API changes returning duplicated stage memberships; custom fields mapping several stages onto one item.","solutions":["Ensure the source work item is assigned to exactly one board stage before the rule triggers.","Fix provider-side stage configuration so items map to a single column/stage.","Add a rule filter that skips items without an exclusive stage instead of binding them.","Inspect item.stages in the payload and normalize it (pick/require one) upstream of prepareFactoryRuleBinding."],"exampleFix":"// before\nawait prepareFactoryRuleBinding({ item }); // throws when item.stages = []\n// after\nif (item.stages.length === 1) {\n  await prepareFactoryRuleBinding({ item });\n} else {\n  logger.warn('Skipping item without exclusive stage', { id: item.id, stages: item.stages });\n}","handlingStrategy":"validation","validationCode":"function hasExclusiveStage(item: { stages: unknown[] }): boolean {\n  return Array.isArray(item.stages) && item.stages.length === 1;\n}\nif (!hasExclusiveStage(item)) skipBinding(item);","typeGuard":"function isSingleStageItem(item: { stages: string[] }): item is { stages: [string] } {\n  return item.stages.length === 1;\n}","tryCatchPattern":"try {\n  await prepareFactoryRuleBinding(input);\n} catch (e) {\n  if (e instanceof FactoryDispatchError && e.code === 'unsupported_provider_item') {\n    logger.warn('Work item has no exclusive board stage; skipping', { id: input.item.id, stages: input.item.stages });\n    return null; // skip instead of failing the whole sync\n  }\n  throw e;\n}","preventionTips":["Filter webhook rules to items with exactly one stage/column.","Normalize multi-stage items upstream (e.g. choose the first stage) before dispatch.","Alert on provider payloads where stages is empty — usually a board misconfiguration."],"tags":["dispatch","board","validation","provider-item"],"backgroundTag":"unsupported-provider-item","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}