windmill-labs/windmill · error
${str} does not start with ${prefix}
Error message
${str} does not start with ${prefix} What it means
removePathPrefix strips a known prefix (e.g. u/<user>, f/<folder>) from a sync path and asserts the string actually starts with it; being called with a path lacking that prefix means the item is outside the directory layout the caller assumed.
Source
Thrown at cli/src/types.ts:530
scriptPath: match[1],
isFlow: match[2] === "flow",
externalId: match[3],
serviceName: match[4],
};
}
export function removePathPrefix(str: string, prefix: string) {
// Normalize paths for cross-platform compatibility and convert to forward slashes for API consistency
const normalizedStr = path.normalize(str).replaceAll(SEP, "/");
const normalizedPrefix = path.normalize(prefix).replaceAll(SEP, "/");
// Handle exact match case
if (normalizedStr === normalizedPrefix) {
return "";
}
if (!normalizedStr.startsWith(normalizedPrefix + "/")) {
throw new Error(str + " does not start with " + prefix);
}
return normalizedStr.slice(normalizedPrefix.length + 1);
}
View on GitHub (pinned to e474e8803c)
Solutions
- Check that the path is inside the expected prefix directory for this item type.
- Fix the path layout so items sit under the folder the sync expects.
- Check for mixed separators or double slashes that break prefix matching.
Defensive patterns
Strategy: type-guard
When it happens
Trigger: Thrown at cli/src/types.ts:530 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/c6a6ad1d690ec534.
Report an issue: GitHub.