windmill-labs/windmill · error

Failed to get url from git repo resource, please check that

Error message

Failed to get url from git repo resource, please check that the resource has the correct type (git_repository)

What it means

handle_ansible_job reads the job's git-repo dependency resource and requires a string `url` field. If the resource object has no `url` string (or the resource isn't a git_repository-shaped object), this error tells the user the resource type/content is wrong.

Source

Thrown at backend/windmill-worker/src/ansible_executor.rs:1730

                    validate_relative_path(&p, "delegate_to_git_repo.inventories_location")?;
                    Ok(p)
                })
                .transpose()?;

            let serde_json::Value::Object(git_repo_resource) = client
                .get_resource_value_interpolated::<serde_json::Value>(
                    &delegated_git_repo.resource,
                    Some(job.id.to_string()),
                )
                .await?
            else {
                return Err(windmill_common::error::Error::BadRequest(
                    "Git repository resource is not an object".to_string(),
                ));
            };

            let secret_url = git_repo_resource.get("url").and_then(|s| s.as_str()).map(|s| s.to_string())
                .ok_or(anyhow!("Failed to get url from git repo resource, please check that the resource has the correct type (git_repository)"))?;

            #[cfg(feature = "enterprise")]
            let is_github_app = git_repo_resource.get("is_github_app").and_then(|s| s.as_bool())
                .ok_or(anyhow!("Failed to get `is_github_app` field from git repo resource, please check that the resource has the correct type (git_repository)"))?;
            #[cfg(not(feature = "enterprise"))]
            let is_github_app = false;

            let branch = Some(git_repo_resource.get("branch").and_then(|s| s.as_str()).map(|s| s.to_string())
                .ok_or(anyhow!("Failed to get branch from git repo resource, please check that the resource has the correct type (git_repository)"))?).filter(|s| !s.is_empty());

            let target_path = DELEGATE_GIT_REPO_TARGET.to_string();

            let repo = GitRepo {
                url: secret_url,
                commit: interpolated_commit.clone(),
                branch,
                target_path,
            };

View on GitHub (pinned to e474e8803c)

Solutions

  1. Open the resource in the Windmill UI and confirm its type is `git_repository`.
  2. Add/fix the `url` field so it is a string containing the repo URL.
  3. Check the job's dependency settings point at the intended resource path.
  4. Recreate the resource from the git_repository template if the payload is malformed.

Example fix

// resource payload
// before
{ "type": "git_repository", "branch": "main" }
// after
{ "type": "git_repository", "url": "https://github.com/org/repo.git", "branch": "main" }
Defensive patterns

Strategy: validation

Validate before calling

// validate the resource payload before binding it to a job:
const r = /* resource object */;
if (typeof r !== 'object' || typeof r.url !== 'string' || r.url.length === 0) {
  throw new Error('resource must be a git_repository with a string url');
}

Type guard

function isGitRepoResource(v: unknown): v is { url: string; [k: string]: unknown } {
  return typeof v === 'object' && v !== null && typeof (v as any).url === 'string';
}

Try / catch

try {
  const url = gitRepoResource.url;
} catch (e) {
  throw new Error('git_repository resource invalid: check type and url field');
}

Prevention

When it happens

Trigger: An ansible job declares a git repo dependency whose bound resource path resolves to an object lacking a `url` string field — e.g. the resource was created with the wrong type or an incomplete JSON payload.

Common situations: Resource typed as something other than git_repository; hand-edited resource JSON missing `url`; `url` stored as a non-string (number/null); resource path typo resolving to a different object.

Related errors


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