{"record":{"id":"c6a6ad1d690ec534","repo":"windmill-labs/windmill","slug":"str-does-not-start-with-prefix","errorCode":null,"errorMessage":"${str} does not start with ${prefix}","messagePattern":"(.+?) does not start with (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cli/src/types.ts","lineNumber":530,"sourceCode":"    scriptPath: match[1],\n    isFlow: match[2] === \"flow\",\n    externalId: match[3],\n    serviceName: match[4],\n  };\n}\n\nexport function removePathPrefix(str: string, prefix: string) {\n  // Normalize paths for cross-platform compatibility and convert to forward slashes for API consistency\n  const normalizedStr = path.normalize(str).replaceAll(SEP, \"/\");\n  const normalizedPrefix = path.normalize(prefix).replaceAll(SEP, \"/\");\n\n  // Handle exact match case\n  if (normalizedStr === normalizedPrefix) {\n    return \"\";\n  }\n\n  if (!normalizedStr.startsWith(normalizedPrefix + \"/\")) {\n    throw new Error(str + \" does not start with \" + prefix);\n  }\n  return normalizedStr.slice(normalizedPrefix.length + 1);\n}\n","sourceCodeStart":512,"sourceCodeEnd":534,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/cli/src/types.ts#L512-L534","documentation":"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.","triggerScenarios":"Thrown at cli/src/types.ts:530 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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."],"exampleFix":null,"handlingStrategy":"type-guard","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"}