windmill-labs/windmill · error

Repository not found or no resource path

Error message

Repository not found or no resource path

What it means

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.

Source

Thrown at frontend/src/lib/components/git_sync/GitSyncContext.svelte.ts:309

	}

	function showSuccessModal(savedWithoutInit?: boolean, autoPullOn?: boolean) {
		activeModals.success = { open: true, savedWithoutInit, autoPullOn }
	}

	function closeSuccessModal() {
		closeModal('success')
	}

	function getValidation(idx: number): ValidationState {
		const states = getValidationStates()
		return states[idx] || { isValid: false, isDuplicate: false, hasChanges: false }
	}

	async function detectRepository(idx: number) {
		const repo = repositories[idx]
		if (!repo || !repo.git_repo_resource_path) {
			throw new Error('Repository not found or no resource path')
		}

		repo.detectionState = 'loading'
		repo.detectionError = undefined
		repo.detectionJobId = undefined
		repo.detectionJobStatus = undefined

		// Track the detection timestamp to avoid race conditions from old jobs
		const detectionTimestamp = Date.now()

		try {
			const jobId = await JobService.runScriptByPath({
				workspace,
				path: hubPaths.gitInitRepo,
				requestBody: {
					workspace_id: workspace,
					repo_url_resource_path: repo.git_repo_resource_path,
					dry_run: true,

View on GitHub (pinned to e474e8803c)

Solutions

  1. Ensure a git repo resource path is selected/configured on the repository before triggering detection.
  2. Disable detection UI actions until the form passes a path check.
  3. Re-read the repository by a stable id rather than a captured index after list mutations.

Example fix

// before
await detectRepository(idx)
// after
const repo = repositories[idx]
if (repo?.git_repo_resource_path) {
  await detectRepository(idx)
} else {
  toast.error('Select a git repository resource first')
}
Defensive patterns

Strategy: validation

Validate before calling

const repo = repositories[idx]
const canDetect = Boolean(repo?.git_repo_resource_path)
if (!canDetect) {
  toast.error('Select a git repository resource first')
  return
}

Type guard

function isDetectable(r: RepositoryEntry | undefined): r is RepositoryEntry & { git_repo_resource_path: string } {
  return !!r && typeof r.git_repo_resource_path === 'string' && r.git_repo_resource_path.length > 0
}

Try / catch

try {
  await detectRepository(idx)
} catch (e) {
  if (e.message.includes('Repository not found')) {
    repo.detectionError = 'No resource path configured'
    return
  }
  throw e
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "missing required config value" errors: why libraries refuse to start when a configuration key is empty, unset, or blank — this error's family across 48 libraries.

Related errors


AI-assisted analysis of windmill-labs/windmill@e474e8803c (2026-09-03). Data as JSON: /api/errors/d889e86f369a6c5f. Report an issue: GitHub.