{"record":{"id":"a2903c56617317a0","repo":"windmill-labs/windmill","slug":"found-two-resource-files-for-the-same-resource-v","errorCode":null,"errorMessage":"Found two resource files for the same resource + validCandidates","messagePattern":"Found two resource files for the same resource \\+ validCandidates","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/commands/script/script.ts","lineNumber":283,"sourceCode":"    candidates.unshift(branchSpecificJSON, branchSpecificYAML);\n  }\n\n  const validCandidates = (\n    await Promise.all(\n      candidates.map((x) => {\n        return stat(x)\n          .catch(() => undefined)\n          .then((x) => x?.isFile())\n          .then((e) => {\n            return { path: x, file: e };\n          });\n      })\n    )\n  )\n    .filter((x) => x.file)\n    .map((x) => x.path);\n  if (validCandidates.length > 1) {\n    throw new Error(\n      \"Found two resource files for the same resource\" +\n        validCandidates.join(\", \")\n    );\n  }\n  if (validCandidates.length < 1) {\n    throw new Error(`No resource matching file resource: ${path}.`);\n  }\n  return validCandidates[0];\n}\n\n// The separator is whatever the local filesystem uses, so both are accepted:\n// on Windows these paths reach us as `my_script__mod\\script.yaml`.\nconst MODULE_ENTRY_META_RE = /([\\\\/])script\\.(yaml|json|lock)$/;\n\n/**\n * Whether a path is a module folder's own metadata file (`__mod/script.yaml`).\n * `isModuleEntryPoint` already pins the file to `script.*` directly under\n * `__mod/`, so this only narrows it to the metadata extensions: a `script.yaml`","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/commands/script/script.ts#L265-L301","documentation":"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.","triggerScenarios":"Thrown at cli/src/commands/script/script.ts:283 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Delete or rename one of the duplicate files so only a single resource file remains.","If one file is meant for a different git branch, the branch-specific selection already handles it — remove the stray variant."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}