{"record":{"id":"b19388b65a9b48af","repo":"paperclipai/paperclip","slug":"persisted-cloud-runtime-identity-is-malformed","errorCode":null,"errorMessage":"Persisted Cloud runtime identity is malformed","messagePattern":"Persisted Cloud runtime identity is malformed","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/src/services/cloud-runtime-identity.ts","lineNumber":110,"sourceCode":"    stackSlug: row.stackSlug,\n    appliedAt: row.appliedAt,\n  };\n}\n\nfunction parsePersistedIdentity(row: {\n  general: Record<string, unknown>;\n  createdAt: Date;\n}): PersistedRuntimeIdentity {\n  const value = row.general;\n  if (\n    value.v !== 1\n    || typeof value.stackId !== \"string\"\n    || typeof value.claimId !== \"string\"\n    || typeof value.previousOrigin !== \"string\"\n    || typeof value.canonicalOrigin !== \"string\"\n    || typeof value.stackSlug !== \"string\"\n  ) {\n    throw new Error(\"Persisted Cloud runtime identity is malformed\");\n  }\n  return {\n    stackId: value.stackId,\n    claimId: value.claimId,\n    previousOrigin: value.previousOrigin,\n    canonicalOrigin: value.canonicalOrigin,\n    stackSlug: value.stackSlug,\n    appliedAt: row.createdAt,\n  };\n}\n\nasync function readPersistedIdentity(db: RuntimeIdentityDb): Promise<PersistedRuntimeIdentity | null> {\n  const row = await db\n    .select({\n      general: instanceSettings.general,\n      createdAt: instanceSettings.createdAt,\n    })\n    .from(instanceSettings)","sourceCodeStart":92,"sourceCodeEnd":128,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/server/src/services/cloud-runtime-identity.ts#L92-L128","documentation":"Validation error thrown by parsePersistedIdentity in cloud-runtime-identity.ts. It fires when the persisted Cloud runtime identity row (from the general settings store) does not match the expected v1 shape: value.v !== 1 or any of stackId, claimId, previousOrigin, canonicalOrigin, stackSlug is missing or not a string. This is a generic guard against a corrupted, partially-written, or older-version identity record; the faulty input is the persisted identity document itself.","triggerScenarios":"Thrown at server/src/services/cloud-runtime-identity.ts:110 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the persisted identity row and delete/reset it so a fresh Cloud runtime identity claim can be written on next startup","Verify the instance was not downgraded from a newer schema version (v mismatch) and migrate the record instead of failing","Log which specific field failed validation to distinguish corruption from a version mismatch"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-10T03:14:50.855Z","contentChangedAt":"2026-09-10T03:14:50.855Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}