windmill-labs/windmill · error

Found two resource files for the same resource +…

Error message

Found two resource files for the same resource + validCandidates

What it means

findResourceFile looks for the resource file of one item among several naming candidates (.json/.yaml, branch-specific variants). When more than one candidate exists on disk the CLI cannot know which one is authoritative, so it refuses instead of silently picking one.

Solutions

  1. Delete or rename one of the duplicate files so only a single resource file remains.
  2. If one file is meant for a different git branch, the branch-specific selection already handles it — remove the stray variant.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at cli/src/commands/script/script.ts:283 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at cli/src/commands/script/script.ts:283

    candidates.unshift(branchSpecificJSON, branchSpecificYAML);
  }

  const validCandidates = (
    await Promise.all(
      candidates.map((x) => {
        return stat(x)
          .catch(() => undefined)
          .then((x) => x?.isFile())
          .then((e) => {
            return { path: x, file: e };
          });
      })
    )
  )
    .filter((x) => x.file)
    .map((x) => x.path);
  if (validCandidates.length > 1) {
    throw new Error(
      "Found two resource files for the same resource" +
        validCandidates.join(", ")
    );
  }
  if (validCandidates.length < 1) {
    throw new Error(`No resource matching file resource: ${path}.`);
  }
  return validCandidates[0];
}

// The separator is whatever the local filesystem uses, so both are accepted:
// on Windows these paths reach us as `my_script__mod\script.yaml`.
const MODULE_ENTRY_META_RE = /([\\/])script\.(yaml|json|lock)$/;

/**
 * Whether a path is a module folder's own metadata file (`__mod/script.yaml`).
 * `isModuleEntryPoint` already pins the file to `script.*` directly under
 * `__mod/`, so this only narrows it to the metadata extensions: a `script.yaml`

View on GitHub (pinned to e474e8803c)