{"record":{"id":"adeb47f599b0e1ea","repo":"mastra-ai/mastra","slug":"repository-url-or-path-is-required","errorCode":null,"errorMessage":"Repository URL or path is required","messagePattern":"Repository URL or path is required","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/agent-builder/src/workflows/template-builder/template-builder.ts","lineNumber":71,"sourceCode":"  resolveTargetPath,\n  mergeGitignoreFiles,\n  mergeEnvFiles,\n  resolveModel,\n} from '../../utils';\n\ntype AgentBuilderInputSchemaType = z.infer<typeof AgentBuilderInputSchema>;\n\n// Step 1: Clone template to temp directory\nconst cloneTemplateStep = createStep({\n  id: 'clone-template',\n  description: 'Clone the template repository to a temporary directory at the specified ref',\n  inputSchema: AgentBuilderInputSchema,\n  outputSchema: CloneTemplateResultSchema,\n  execute: async ({ inputData }) => {\n    const { repo, ref = 'main', slug, targetPath } = inputData;\n\n    if (!repo) {\n      throw new Error('Repository URL or path is required');\n    }\n\n    // Extract slug from repo URL if not provided\n    const inferredSlug =\n      slug ||\n      repo\n        .split('/')\n        .pop()\n        ?.replace(/\\.git$/, '') ||\n      'template';\n\n    // Create temporary directory\n    const tempDir = await mkdtemp(join(tmpdir(), 'mastra-template-'));\n\n    try {\n      // Clone repository\n      await gitClone(repo, tempDir);\n","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/packages/agent-builder/src/workflows/template-builder/template-builder.ts#L53-L89","documentation":"The clone step of the template-builder workflow requires `repo` in its input (AgentBuilderInputSchema output) and throws 'Repository URL or path is required' when inputData.repo is missing or empty. The workflow otherwise infers slug and defaults ref, but repo is the one mandatory identifier of what to clone.","triggerScenarios":"Starting the template-builder workflow with input that omits `repo` (only slug/targetPath supplied), or providing an empty string; constructing the input object manually rather than through the tool/UI that normally populates repo.","commonSituations":"Calling the workflow directly from code with a partial input object; a UI/tool layer passing only the slug; input schema drift so repo exists under another key; test harnesses that build inputs by hand.","solutions":["Pass a repository URL or local path in the input: { repo: 'https://github.com/mastra-ai/templates/...' }","If you only have a slug, resolve the repo URL from the templates registry (getMastraTemplate) before starting the workflow","Check the input key spelling — it must be `repo`, matching AgentBuilderInputSchema","Pre-validate inputs and surface a friendly message before invoking the workflow"],"exampleFix":"// before\nawait templateBuilderWorkflow.start({ triggerData: { slug: 'weather-app', ref: 'main' } });\n\n// after\nawait templateBuilderWorkflow.start({\n  triggerData: { repo: 'https://github.com/mastra-ai/template-weather-app', slug: 'weather-app', ref: 'main' },\n});","handlingStrategy":"validation","validationCode":"type BuilderInput = { repo?: string; ref?: string; slug?: string; targetPath?: string };\nfunction assertRepo(input: BuilderInput): asserts input is BuilderInput & { repo: string } {\n  if (typeof input.repo !== 'string' || input.repo.trim() === '') {\n    throw new Error('repo (URL or path) is required to build a template');\n  }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always supply `repo` when starting the template-builder workflow","Resolve slug -> repo URL via the templates registry when only a slug is known","Match input keys to AgentBuilderInputSchema exactly"],"tags":["input-validation","workflow","git"],"backgroundTag":"missing-required-parameter","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}