{"record":{"id":"c4715708c3ccb8b5","repo":"paperclipai/paperclip","slug":"sortdir-must-be-asc-or-desc-when-provided","errorCode":null,"errorMessage":"sortDir must be 'asc' or 'desc' when provided","messagePattern":"sortDir must be 'asc' or 'desc' when provided","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"server/src/routes/issues.ts","lineNumber":6166,"sourceCode":"    if (!workspace || !isClosedIsolatedExecutionWorkspace(workspace)) return null;\n    return workspace;\n  }\n\n  // Reopen the closed isolated workspace that a guard found, so the request can\n  // continue. The return value tells the caller what happened:\n  //   \"reopened\"    - this request rebuilt the workspace and set the\n  //                   reopen-pending flag. The caller must install the\n  //                   consumption guard so the flag cannot leak.\n  //   \"already-open\" - a concurrent request already reopened the workspace, so\n  //                   this request did not set the flag. The caller continues but\n  //                   must not install the guard, or it can clear the flag that\n  //                   the other request still owns.\n  //   null          - this function sent an error response, so the caller stops.\n  // The reopen is scoped to the issue company and project inside the service, and\n  // it runs only after the route already authorized the request on the issue.\n  async function reopenClosedIssueExecutionWorkspaceOrRespond(\n    req: Request,\n    res: Response,\n    issue: { id: string; companyId: string; projectId?: string | null },\n    workspace: Pick<ExecutionWorkspace, \"id\">,\n  ): Promise<{ outcome: \"reopened\" | \"already-open\"; generation: number } | null> {\n    const actor = getActorInfo(req);\n    const result = await executionWorkspacesSvc.reopenClosedIsolatedExecutionWorkspaceForIssue({\n      workspaceId: workspace.id,\n      issue: { id: issue.id, companyId: issue.companyId, projectId: issue.projectId ?? null },\n      actor: { agentId: actor.agentId, actorType: actor.actorType },\n    });\n    if (result.ok) {\n      return { outcome: result.reopened ? \"reopened\" : \"already-open\", generation: result.generation };\n    }\n    if (result.code === \"not_reopenable\") {\n      res.status(409).json({ error: \"This issue is linked to a closed workspace that cannot be reopened.\" });\n    } else {\n      res.status(503).json({ error: \"Could not reopen the workspace for this issue. Please try again.\" });\n    }\n    return null;","sourceCodeStart":6148,"sourceCodeEnd":6184,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/routes/issues.ts#L6148-L6184","documentation":"400 from the issue list route: the optional sortDir query parameter was supplied with a value other than 'asc' or 'desc'.","triggerScenarios":"Thrown at server/src/routes/issues.ts:5860 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the offending parameter to satisfy the constraint stated in the error message (type, range, or allowed values), then retry.","Refer to the route's request validation in the named file and the shared validators for the accepted format."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}