{"record":{"id":"487e8971049efd2f","repo":"invoke-ai/InvokeAI","slug":"the-strict-and-append-query-parameters-are-mut","errorCode":null,"errorMessage":"The 'strict' and 'append' query parameters are mutually exclusive","messagePattern":"The 'strict' and 'append' query parameters are mutually exclusive","errorType":"http","errorClass":"HTTPException","httpStatus":400,"severity":"warning","filePath":"invokeai/app/api/routers/recall_parameters.py","lineNumber":454,"sourceCode":"            exclusive with ``strict`` (which clears omitted parameters).\n\n    Returns:\n        A dictionary containing the updated parameters and status\n\n    Example:\n        POST /api/v1/recall/{queue_id}?strict=true\n        {\n            \"positive_prompt\": \"a beautiful landscape\",\n            \"model\": \"sd-1.5\",\n            \"steps\": 20\n        }\n        # In strict mode, all other parameters (reference_images, loras, etc.)\n        # are cleared.  In non-strict mode (default) they would be left as-is.\n    \"\"\"\n    logger = ApiDependencies.invoker.services.logger\n\n    if strict and append:\n        raise HTTPException(\n            status_code=400,\n            detail=\"The 'strict' and 'append' query parameters are mutually exclusive\",\n        )\n\n    # Validate image access before processing — prevents information leakage\n    # (dimensions) and derived-image minting via ControlNet preprocessors.\n    _assert_recall_image_access(parameters, current_user)\n    assert_image_move_maintenance_inactive()\n\n    try:\n        # In strict mode, include all parameters so the frontend clears anything\n        # not explicitly provided.  List-typed fields use [] instead of None so\n        # the frontend sees an empty collection rather than a null it might skip.\n        if strict:\n            _list_fields = {\n                name for name, field in RecallParameter.model_fields.items() if \"list\" in str(field.annotation).lower()\n            }\n            provided_params = {","sourceCodeStart":436,"sourceCodeEnd":472,"githubUrl":"https://github.com/invoke-ai/InvokeAI/blob/0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06/invokeai/app/api/routers/recall_parameters.py#L436-L472","documentation":"HTTP 400 raised by update_recall_parameters when both the 'strict' and 'append' query parameters are truthy. strict means 'set exactly these parameters, clearing everything else'; append means 'add to what's already set' — the two modes are contradictory, so the endpoint rejects the combination.","triggerScenarios":"POST /api/v1/recall_parameters/{queue_id}?strict=true&append=true (or both flags set) — a client bug combining mode flags, or a UI checkbox pair that allows both to be ticked.","commonSituations":"Building the query string dynamically and defaulting both flags to true; merging two feature toggles without exclusivity validation in the UI.","solutions":["Send at most one of strict/append as true — typically strict=true for 'replace' semantics and omit append","Fix the client to make the two flags mutually exclusive (radio buttons / single mode enum)","If you want replace semantics, drop append; for additive updates, drop strict"],"exampleFix":"// before\nconst qs = `strict=${strict}&append=${append}`;\n// after\nconst mode = strict ? 'strict=true' : append ? 'append=true' : '';\nconst qs = mode; // never both","handlingStrategy":"validation","validationCode":"if (strict && append) {\n  throw new Error('strict and append are mutually exclusive');\n}","typeGuard":"type RecallMode = { strict: true; append?: false } | { strict?: false; append: true } | {};\nfunction buildRecallQuery(mode: RecallMode): string {\n  if ('strict' in mode && mode.strict && 'append' in mode && mode.append) throw new Error('exclusive flags');\n  return mode.strict ? 'strict=true' : mode.append ? 'append=true' : '';\n}","tryCatchPattern":"try {\n  await api.recallParameters(queueId, params, { strict, append });\n} catch (e) {\n  if (e.status === 400 && /mutually exclusive/.test(e.body?.detail ?? '')) {\n    // retry with strict only\n    await api.recallParameters(queueId, params, { strict: true });\n  } else throw e;\n}","preventionTips":["Model the mode as a single enum (replace|append) rather than two booleans","Use radio buttons/exclusive toggles in UIs for these flags","Sanitize dynamically built query strings so defaults never set both flags"],"tags":["http-400","validation","query-parameters"],"backgroundTag":"mutually-exclusive-parameters","analyzedSha":"0b6a024f2ff6a86bfb953dcdb9cc504ef7397a06","analyzedAt":"2026-08-29T04:46:49.967Z","schemaVersion":2},"datasetVersion":"2026-08-29T07:17:48.351Z"}