{"record":{"id":"d2a50b44b7647ab4","repo":"mastra-ai/mastra","slug":"query-parameter-status-must-be-draft-or-publi-d2a50b","errorCode":null,"errorMessage":"Query parameter \"status\" must be \"draft\" or \"published\"","messagePattern":"Query parameter \"status\" must be \"draft\" or \"published\"","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client-sdks/ai-sdk/src/network-route.ts","lineNumber":345,"sourceCode":"        mastra\n          .getLogger()\n          ?.warn(`Multiple \"requestContext\" sources provided. Using priority: middleware > route options > body.`);\n      }\n\n      if (!agentToUse) {\n        throw new Error('Agent ID is required');\n      }\n\n      // Resolve agent version from query params, falling back to static option\n      const queryVersionId = c.req.query('versionId');\n      const rawStatus = c.req.query('status');\n\n      if (queryVersionId && rawStatus) {\n        throw new Error('Query parameters \"versionId\" and \"status\" are mutually exclusive');\n      }\n\n      if (rawStatus && rawStatus !== 'draft' && rawStatus !== 'published') {\n        throw new Error('Query parameter \"status\" must be \"draft\" or \"published\"');\n      }\n\n      const queryStatus = rawStatus as 'draft' | 'published' | undefined;\n      const effectiveAgentVersion: AgentVersionOptions | undefined = queryVersionId\n        ? { versionId: queryVersionId }\n        : queryStatus\n          ? { status: queryStatus }\n          : agentVersion;\n\n      const handlerOptions = {\n        mastra,\n        agentId: agentToUse,\n        agentVersion: effectiveAgentVersion,\n        params: {\n          ...params,\n          requestContext: effectiveRequestContext,\n        } as any,\n        defaultOptions,","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/client-sdks/ai-sdk/src/network-route.ts#L327-L363","documentation":"The 'status' query parameter on the agent/network route accepts only the literal values 'draft' or 'published'. This library throws when status is present but any other string, because the route cannot map an unknown status to an agent version.","triggerScenarios":"GET /api/network/agents/my-agent?status=staging, ?status=DRAFT (case-sensitive), ?status=production, or any misspelled value like ?status=pulished.","commonSituations":"Hand-typed URLs in a browser; environment-specific URL templates that inject a non-supported stage name; case-sensitivity surprises ('Draft' vs 'draft'); copying params from other APIs that use different status vocabularies.","solutions":["Change the status value to exactly 'draft' or 'published' (lowercase).","If you need a specific historical version, use the versionId query parameter instead of status.","Validate/normalize the status string in the client before appending it to the URL.","Check for typos and casing in URL templates or env-driven config."],"exampleFix":"// before\nfetch(`/api/network/agents/${id}?status=${stage}`); // stage = 'production'\n// after\nfetch(`/api/network/agents/${id}?status=published`);","handlingStrategy":"validation","validationCode":"const allowed = ['draft', 'published'] as const;\ntype Status = typeof allowed[number];\nfunction assertStatus(s: string): asserts s is Status {\n  if (!allowed.includes(s as Status)) throw new Error(`status must be draft|published, got ${s}`);\n}","typeGuard":"function isAgentStatus(s: unknown): s is 'draft' | 'published' {\n  return s === 'draft' || s === 'published';\n}","tryCatchPattern":null,"preventionTips":["Type the status as the union 'draft' | 'published' in client code.","Normalize user/env input to lowercase before sending.","Keep status values in a shared constant, not inline strings."],"tags":["http","query-parameters","validation","client-sdk"],"backgroundTag":"invalid-query-parameter-value","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T08:17:16.595Z"}