{"record":{"id":"c6942075a8ee11d5","repo":"hcengineering/platform","slug":"invalid-includeattachments-must-be-boolean","errorCode":null,"errorMessage":"Invalid includeAttachments. Must be boolean","messagePattern":"Invalid includeAttachments\\. Must be boolean","errorType":"http","errorClass":"ApiError","httpStatus":400,"severity":"error","filePath":"services/export/pod-export/src/server.ts","lineNumber":504,"sourceCode":"          includeChildren?: boolean\n        } = req.body\n\n        // Validate required parameters\n        if (targetWorkspace == null || typeof targetWorkspace !== 'string') {\n          measureCtx.warn(`Invalid targetWorkspace parameter: ${String(targetWorkspace)}`)\n          throw new ApiError(400, 'Missing or invalid required parameter: targetWorkspace')\n        }\n        if (_class == null || typeof _class !== 'string') {\n          measureCtx.warn(`Invalid _class parameter: ${String(_class)}`)\n          throw new ApiError(400, 'Missing or invalid required parameter: _class')\n        }\n        if (conflictStrategy !== undefined && conflictStrategy !== 'skip' && conflictStrategy !== 'duplicate') {\n          measureCtx.warn(`Invalid conflictStrategy: ${String(conflictStrategy)}`)\n          throw new ApiError(400, 'Invalid conflictStrategy. Must be \"skip\" or \"duplicate\"')\n        }\n        if (includeAttachments !== undefined && typeof includeAttachments !== 'boolean') {\n          measureCtx.warn(`Invalid includeAttachments: ${String(includeAttachments)}`)\n          throw new ApiError(400, 'Invalid includeAttachments. Must be boolean')\n        }\n\n        decodedToken = decodeToken(token)\n        if (decodedToken.extra?.readonly !== undefined) {\n          throw new ApiError(403, 'Forbidden: read-only token')\n        }\n\n        // Get target workspace info\n        const accountClient = getClient(envConfig.AccountsUrl, token)\n        const targetWsLoginInfo = await accountClient.getLoginWithWorkspaceInfo()\n\n        const targetWsInfo = targetWsLoginInfo.workspaces[targetWorkspace]\n        if (targetWsInfo === undefined) {\n          measureCtx.warn(`Target workspace not found or not accessible: ${targetWorkspace}`)\n          throw new ApiError(404, 'Target workspace not found or not accessible')\n        }\n\n        // Verify user has write access to target workspace","sourceCodeStart":486,"sourceCodeEnd":522,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/services/export/pod-export/src/server.ts#L486-L522","documentation":"The pod-export server validates the optional `includeAttachments` parameter must be a boolean when supplied. This HTTP 400 error is thrown when the value is present but not of boolean type, protecting the export handler from coercible-but-wrong types.","triggerScenarios":"Passing includeAttachments='true' (string), 1 (number), 'yes', or any non-boolean value to the export endpoint.","commonSituations":"Query-string parameters arrive as strings, so callers who take user input straight from a URL or form and forward it verbatim hit this; scripts quoting booleans; JSON bodies using 0/1 instead of true/false.","solutions":["Send a real boolean: includeAttachments=true or includeAttachments=false (unquoted, boolean JSON type).","Coerce before sending in the client: value === 'true' ? true : value === 'false' ? false : undefined.","Omit the parameter if the default behavior is fine."],"exampleFix":"// before\nparams.includeAttachments = 'true'\n// after\nparams.includeAttachments = String(raw).toLowerCase() === 'true' ? true : undefined","handlingStrategy":"validation","validationCode":"if (includeAttachments !== undefined && typeof includeAttachments !== 'boolean') {\n  throw new Error('includeAttachments must be a boolean when provided')\n}","typeGuard":"function isBooleanOrUndefined(v: unknown): v is boolean | undefined {\n  return v === undefined || typeof v === 'boolean'\n}","tryCatchPattern":"try {\n  await exportPod(params)\n} catch (err) {\n  if (err instanceof ApiError && err.status === 400 && /includeAttachments/.test(err.message)) {\n    console.error('includeAttachments must be a real boolean, not a string/number')\n  } else throw err\n}","preventionTips":["Coerce query-string values ('true'/'false') to booleans before sending.","Use boolean JSON types in request bodies, never 0/1 or 'yes'/'no'.","Type the field as boolean | undefined in the client payload interface."],"tags":["api","validation","type-error"],"backgroundTag":"invalid-parameter-type","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}