{"record":{"id":"d889e86f369a6c5f","repo":"windmill-labs/windmill","slug":"repository-not-found-or-no-resource-path","errorCode":null,"errorMessage":"Repository not found or no resource path","messagePattern":"Repository not found or no resource path","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"frontend/src/lib/components/git_sync/GitSyncContext.svelte.ts","lineNumber":309,"sourceCode":"\t}\n\n\tfunction showSuccessModal(savedWithoutInit?: boolean, autoPullOn?: boolean) {\n\t\tactiveModals.success = { open: true, savedWithoutInit, autoPullOn }\n\t}\n\n\tfunction closeSuccessModal() {\n\t\tcloseModal('success')\n\t}\n\n\tfunction getValidation(idx: number): ValidationState {\n\t\tconst states = getValidationStates()\n\t\treturn states[idx] || { isValid: false, isDuplicate: false, hasChanges: false }\n\t}\n\n\tasync function detectRepository(idx: number) {\n\t\tconst repo = repositories[idx]\n\t\tif (!repo || !repo.git_repo_resource_path) {\n\t\t\tthrow new Error('Repository not found or no resource path')\n\t\t}\n\n\t\trepo.detectionState = 'loading'\n\t\trepo.detectionError = undefined\n\t\trepo.detectionJobId = undefined\n\t\trepo.detectionJobStatus = undefined\n\n\t\t// Track the detection timestamp to avoid race conditions from old jobs\n\t\tconst detectionTimestamp = Date.now()\n\n\t\ttry {\n\t\t\tconst jobId = await JobService.runScriptByPath({\n\t\t\t\tworkspace,\n\t\t\t\tpath: hubPaths.gitInitRepo,\n\t\t\t\trequestBody: {\n\t\t\t\t\tworkspace_id: workspace,\n\t\t\t\t\trepo_url_resource_path: repo.git_repo_resource_path,\n\t\t\t\t\tdry_run: true,","sourceCodeStart":291,"sourceCodeEnd":327,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/frontend/src/lib/components/git_sync/GitSyncContext.svelte.ts#L291-L327","documentation":"detectRepository kicks off branch/resource detection for a git-sync repository entry at index idx. It throws when the entry is missing from the repositories array or when it has no git_repo_resource_path — i.e., there is no configured git resource to run detection against.","triggerScenarios":"Calling detectRepository(idx) with an out-of-range index, or on a newly added repository row that has no git repo resource path selected yet.","commonSituations":"Clicking a 'detect branches' action on a half-filled repository form; repositories array reindexed while a stale index was captured in a closure; legacy imports lacking a resource path.","solutions":["Ensure a git repo resource path is selected/configured on the repository before triggering detection.","Disable detection UI actions until the form passes a path check.","Re-read the repository by a stable id rather than a captured index after list mutations."],"exampleFix":"// before\nawait detectRepository(idx)\n// after\nconst repo = repositories[idx]\nif (repo?.git_repo_resource_path) {\n  await detectRepository(idx)\n} else {\n  toast.error('Select a git repository resource first')\n}","handlingStrategy":"validation","validationCode":"const repo = repositories[idx]\nconst canDetect = Boolean(repo?.git_repo_resource_path)\nif (!canDetect) {\n  toast.error('Select a git repository resource first')\n  return\n}","typeGuard":"function isDetectable(r: RepositoryEntry | undefined): r is RepositoryEntry & { git_repo_resource_path: string } {\n  return !!r && typeof r.git_repo_resource_path === 'string' && r.git_repo_resource_path.length > 0\n}","tryCatchPattern":"try {\n  await detectRepository(idx)\n} catch (e) {\n  if (e.message.includes('Repository not found')) {\n    repo.detectionError = 'No resource path configured'\n    return\n  }\n  throw e\n}","preventionTips":["Disable detect buttons until a resource path is chosen.","Reference repositories by stable id, not captured indexes.","Require resource path in the add-repository form before submission."],"tags":["svelte","git-sync","missing-config"],"backgroundTag":"missing-config-value","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}