{"record":{"id":"d92f9cb42475f2df","repo":"mastra-ai/mastra","slug":"failed-to-create-account-d92f9c","errorCode":null,"errorMessage":"Failed to create account","messagePattern":"Failed to create account","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"auth/neon/src/index.ts","lineNumber":334,"sourceCode":"    email: string,\n    password: string,\n    name: string | undefined,\n    request: Request,\n  ): Promise<CredentialsResult<EEUser>> {\n    const displayName = name ?? email.split('@')[0] ?? 'User';\n\n    const response = await fetch(`${this.baseUrl}/auth/sign-up/email`, {\n      method: 'POST',\n      headers: {\n        'Content-Type': 'application/json',\n        ...(request?.headers ? Object.fromEntries(request.headers.entries()) : {}),\n      },\n      body: JSON.stringify({ email, password, name: displayName }),\n    });\n\n    if (!response.ok) {\n      const errorData = (await response.json().catch(() => ({}))) as { message?: string };\n      throw new Error(errorData.message || 'Failed to create account');\n    }\n\n    const result = (await response.json()) as { user?: NeonSessionResponse['user']; token?: string | null };\n\n    if (!result?.user) {\n      throw new Error('Failed to create account');\n    }\n\n    const cookies = parseCookies(response);\n\n    return {\n      user: mapNeonUserToEEUser(result.user),\n      token: result.token ?? undefined,\n      cookies,\n    };\n  }\n\n  // ── ISessionProvider ──","sourceCodeStart":316,"sourceCodeEnd":352,"githubUrl":"https://github.com/mastra-ai/mastra/blob/75dd419e613fe9c39f846ffc500716141b74fda6/auth/neon/src/index.ts#L316-L352","documentation":"Thrown by signUp in @mastra/auth/neon when the Neon signup HTTP request returns a non-OK response and the error body carries no readable message, or when the parsed response JSON is missing a `user` field. It is a guard against a signup that did not actually create an account, so the caller never gets an invalid session object.","triggerScenarios":"Calling signUp(email, password, displayName) when the Neon auth API rejects the request (e.g. duplicate email, weak password, 4xx/5xx with an empty or unparseable error body), or when the API returns 200 with a body lacking `user`.","commonSituations":"User already exists with that email; password policy violation; Neon API downtime or proxy returning HTML error pages that fail JSON parsing; misconfigured NEON auth base URL causing an unexpected response shape.","solutions":["Check the server response status/body (log the raw response) to see the real Neon API error such as email-already-registered or weak-password.","Verify the Neon auth endpoint/base URL configuration points at the correct environment.","Retry with a different email or a password that satisfies Neon's policy.","If the API is intermittently failing, retry after checking Neon service status."],"exampleFix":"// before\nawait auth.signUp('user@example.com', '123', 'User');\n// after\ntry {\n  await auth.signUp('user@example.com', 'a-strong-password-123!', 'User');\n} catch (e) {\n  console.error('Signup failed:', e.message); // inspect upstream Neon error\n}","handlingStrategy":"try-catch","validationCode":"const emailOk = /[^@]+@[^@]+\\.[^@]+/.test(email);\nconst passwordOk = typeof password === 'string' && password.length >= 8;\nif (!emailOk || !passwordOk) throw new Error('Invalid signup input');","typeGuard":"function isSignupResult(r: unknown): r is { user: { id: string }; token?: string | null } {\n  return !!r && typeof r === 'object' && 'user' in r && !!(r as any).user;\n}","tryCatchPattern":"try {\n  await auth.signUp(email, password, name);\n} catch (e) {\n  if (e instanceof Error && e.message === 'Failed to create account') {\n    // surface a user-facing message (e.g. email already in use) and let them retry\n  } else throw e;\n}","preventionTips":["Check whether the email already exists before offering signup.","Enforce password policy on the client before calling signUp.","Log the upstream response when debugging to capture Neon's real error."],"tags":["auth","signup","network","http-response"],"backgroundTag":"signup-failed","analyzedSha":"75dd419e613fe9c39f846ffc500716141b74fda6","analyzedAt":"2026-08-30T00:15:31.844Z","schemaVersion":2},"datasetVersion":"2026-08-30T03:17:51.788Z"}