{"record":{"id":"5be7f543621fc027","repo":"calcom/cal.diy","slug":"credentials-not-valid","errorCode":null,"errorMessage":"Credentials not valid","messagePattern":"Credentials not valid","errorType":"http","errorClass":"HttpCode","httpStatus":500,"severity":"error","filePath":"packages/app-store/alby/api/webhook.ts","lineNumber":81,"sourceCode":"                  where: {\n                    type: \"alby_payment\",\n                  },\n                },\n              },\n            },\n          },\n        },\n      },\n    });\n\n    if (!payment) throw new HttpCode({ statusCode: 204, message: \"Payment not found\" });\n    const key = payment.booking?.user?.credentials?.[0].key;\n    if (!key) throw new HttpCode({ statusCode: 204, message: \"Credentials not found\" });\n\n    const parseCredentials = albyCredentialKeysSchema.safeParse(key);\n    if (!parseCredentials.success) {\n      console.error(parseCredentials.error);\n      throw new HttpCode({ statusCode: 500, message: \"Credentials not valid\" });\n    }\n\n    const credentials = parseCredentials.data;\n\n    const albyInvoice = await parseInvoice(bodyAsString, parsedHeaders, credentials.webhook_endpoint_secret);\n    if (!albyInvoice) throw new HttpCode({ statusCode: 204, message: \"Invoice not found\" });\n    if (albyInvoice.amount !== payment.amount) {\n      throw new HttpCode({ statusCode: 400, message: \"invoice amount does not match payment amount\" });\n    }\n\n    const traceContext = distributedTracing.createTrace(\"alby_webhook\", {\n      meta: { paymentId: payment.id, bookingId: payment.bookingId },\n    });\n    return await handlePaymentSuccess({\n      paymentId: payment.id,\n      bookingId: payment.bookingId,\n      appSlug: \"alby\",\n      traceContext,","sourceCodeStart":63,"sourceCodeEnd":99,"githubUrl":"https://github.com/calcom/cal.diy/blob/176037d0afbe572f870a3c702985e7cd83fe6c0c/packages/app-store/alby/api/webhook.ts#L63-L99","documentation":"Thrown when the stored credential key fails albyCredentialKeysSchema validation, which requires account_id, account_email, account_lightning_address, webhook_endpoint_id, and webhook_endpoint_secret. The credential row exists but its key JSON is incomplete or malformed. The parse error is console.error'd before the throw. Surfaced as HTTP 500 because the data is server-owned, not caller-controlled.","triggerScenarios":"Setup flow was interrupted before all fields were persisted; a schema migration introduced a new required field; manual DB edit corrupted the key JSON.","commonSituations":"Partial setup; legacy credential from before webhook_endpoint_secret was introduced; credentials imported/migrated from another instance without all fields.","solutions":["Re-run the Alby setup flow to regenerate a complete credential key.","Inspect the stored credential.key JSON for any missing required fields.","If a new required field was introduced, update existing credentials or run a migration backfill."],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":"const parsed = albyCredentialKeysSchema.safeParse(key);\nif (!parsed.success) {\n  // prompt the user to re-run Alby setup to repopulate the credential key\n}","typeGuard":"const isValidAlbyCredential = (k: unknown) => albyCredentialKeysSchema.safeParse(k).success;","tryCatchPattern":null,"preventionTips":["Run the full Alby setup so all required key fields are persisted.","After schema changes, migrate/backfill existing credential keys.","Never hand-edit credential.key JSON."],"tags":["alby","credential","zod","schema-drift"],"backgroundTag":null,"analyzedSha":"176037d0afbe572f870a3c702985e7cd83fe6c0c","analyzedAt":"2026-08-12T19:12:41.464Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}