hcengineering/platform · error · ApiError
Invalid conflictStrategy. Must be "skip" or "duplicate"
Error message
Invalid conflictStrategy. Must be "skip" or "duplicate"
What it means
The pod-export server's export endpoint validates the optional `conflictStrategy` query/body parameter. This error (HTTP 400) is thrown by createServer's request handler when the parameter is provided but is neither the string 'skip' nor 'duplicate', i.e. the caller requested an unsupported conflict-resolution behavior.
Source
Thrown at services/export/pod-export/src/server.ts:500
objectSpace?: Ref<Space>
fieldMappers?: Record<string, Record<string, any>>
skipDeletedObsolete?: boolean
exportOnlyEffective?: boolean
includeChildren?: boolean
} = req.body
// Validate required parameters
if (targetWorkspace == null || typeof targetWorkspace !== 'string') {
measureCtx.warn(`Invalid targetWorkspace parameter: ${String(targetWorkspace)}`)
throw new ApiError(400, 'Missing or invalid required parameter: targetWorkspace')
}
if (_class == null || typeof _class !== 'string') {
measureCtx.warn(`Invalid _class parameter: ${String(_class)}`)
throw new ApiError(400, 'Missing or invalid required parameter: _class')
}
if (conflictStrategy !== undefined && conflictStrategy !== 'skip' && conflictStrategy !== 'duplicate') {
measureCtx.warn(`Invalid conflictStrategy: ${String(conflictStrategy)}`)
throw new ApiError(400, 'Invalid conflictStrategy. Must be "skip" or "duplicate"')
}
if (includeAttachments !== undefined && typeof includeAttachments !== 'boolean') {
measureCtx.warn(`Invalid includeAttachments: ${String(includeAttachments)}`)
throw new ApiError(400, 'Invalid includeAttachments. Must be boolean')
}
decodedToken = decodeToken(token)
if (decodedToken.extra?.readonly !== undefined) {
throw new ApiError(403, 'Forbidden: read-only token')
}
// Get target workspace info
const accountClient = getClient(envConfig.AccountsUrl, token)
const targetWsLoginInfo = await accountClient.getLoginWithWorkspaceInfo()
const targetWsInfo = targetWsLoginInfo.workspaces[targetWorkspace]
if (targetWsInfo === undefined) {
measureCtx.warn(`Target workspace not found or not accessible: ${targetWorkspace}`)View on GitHub (pinned to 63e28dc964)
Solutions
- Change the request to use conflictStrategy='skip' or conflictStrategy='duplicate' (exact lowercase strings).
- Omit the conflictStrategy parameter entirely if the default behavior is acceptable.
- Fix casing/typos — the comparison is case-sensitive, so 'Skip' is rejected.
Example fix
// before GET /export?_class=task:Task&conflictStrategy=overwrite // after GET /export?_class=task:Task&conflictStrategy=skip
Defensive patterns
Strategy: validation
Validate before calling
const VALID = ['skip', 'duplicate']
if (conflictStrategy !== undefined && !VALID.includes(conflictStrategy)) {
throw new Error(`conflictStrategy must be "skip" or "duplicate", got: ${conflictStrategy}`)
} Type guard
function isConflictStrategy(v: unknown): v is 'skip' | 'duplicate' {
return v === 'skip' || v === 'duplicate'
} Try / catch
try {
await exportPod(params)
} catch (err) {
if (err instanceof ApiError && err.status === 400 && /conflictStrategy/.test(err.message)) {
console.error('Fix conflictStrategy: use "skip" or "duplicate", or omit it')
} else throw err
} Prevention
- Type the parameter as 'skip' | 'duplicate' union in client code so the compiler rejects other values.
- Never hand-build query strings for this endpoint; use a typed client.
- Omit the parameter when default behavior is acceptable.
When it happens
Trigger: Calling the export API with conflictStrategy set to any value other than 'skip' or 'duplicate' (e.g. 'overwrite', 'replace', 'skip_conflicts', or a misspelled variant).
Common situations: Hand-built HTTP requests or scripts passing an invented strategy name; typos like 'Skip' (case-sensitive check); passing a non-string such as a number or boolean; upgrading client code written against an API that accepted other strategy names.
Related errors
AI-assisted analysis of hcengineering/platform@63e28dc964 (2026-08-29).
Data as JSON: /api/errors/b42a7b934dea489e.
Report an issue: GitHub.