{"record":{"id":"a0714b5e50cecb4a","repo":"clockworklabs/SpacetimeDB","slug":"invalid-uuid-must-be-between-0-and-max-uuid-bigi","errorCode":null,"errorMessage":"Invalid UUID: must be between 0 and `MAX_UUID_BIGINT`","messagePattern":"Invalid UUID: must be between 0 and `MAX_UUID_BIGINT`","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/bindings-typescript/src/lib/uuid.ts","lineNumber":77,"sourceCode":"   * );\n   * ```\n   */\n  static readonly MAX = new Uuid(Uuid.MAX_UUID_BIGINT);\n\n  /**\n   * Create a UUID from a raw 128-bit value.\n   *\n   * @param u - Unsigned 128-bit integer\n   * @throws {Error} If the value is outside the valid UUID range\n   */\n  constructor(u: bigint) {\n    // Coerce so callers who arrive via JSON (where bigint precision is\n    // lost) hit the range check rather than a cryptic `Cannot mix\n    // BigInt and other types` error.\n    const v = coerceToBigInt(u, 'Uuid');\n    // Must fit in exactly 16 bytes\n    if (v < 0n || v > Uuid.MAX_UUID_BIGINT) {\n      throw new Error('Invalid UUID: must be between 0 and `MAX_UUID_BIGINT`');\n    }\n    this.__uuid__ = v;\n  }\n\n  /**\n   * Create a UUID `v4` from explicit random bytes.\n   *\n   * This method assumes the bytes are already sufficiently random.\n   * It only sets the appropriate bits for the UUID version and variant.\n   *\n   * @param bytes - Exactly 16 random bytes\n   * @returns A UUID `v4`\n   * @throws {Error} If `bytes.length !== 16`\n   *\n   * @example\n   * ```ts\n   * const randomBytes = new Uint8Array(16);\n   * const uuid = Uuid.fromRandomBytesV4(randomBytes);","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/6dee26c6efc2856793e12b148a59742964f5d783/crates/bindings-typescript/src/lib/uuid.ts#L59-L95","documentation":"A table declared #[spacetimedb::table(scheduled = reducer)] must contain the scheduling columns: #[primary_key] #[auto_inc] scheduled_id: u64 and scheduled_at: spacetimedb::ScheduleAt. When validation finds neither a scheduled_at column (default name or an at = ... override) nor a primary-key column, the macro emits this combined 'add these columns' template instead of two separate errors.","triggerScenarios":"Declaring a scheduled table whose struct has only business columns — no scheduled_at field and no primary-key column — e.g. #[spacetimedb::table(scheduled = tick)] struct Tick { payload: String }.","commonSituations":"Writing the first scheduled reducer; copying a plain table struct and only adding the scheduled argument; following outdated examples that omit the system columns.","solutions":["Add both required columns verbatim: #[primary_key] #[auto_inc] scheduled_id: u64, and scheduled_at: spacetimedb::ScheduleAt,.","Keep the reducer named by scheduled = ... with a matching scheduled-reducer signature.","Do not rename these columns unless using at = ... for scheduled_at."],"exampleFix":"// before\n#[spacetimedb::table(accessor = tick, scheduled = tick_reducer)]\npub struct Tick { pub payload: String }\n\n// after\n#[spacetimedb::table(accessor = tick, scheduled = tick_reducer)]\npub struct Tick {\n    #[primary_key]\n    #[auto_inc]\n    scheduled_id: u64,\n    scheduled_at: spacetimedb::ScheduleAt,\n    pub payload: String,\n}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Start scheduled tables from a template that already contains scheduled_id and scheduled_at.","Run cargo check immediately after adding scheduled = ... so missing columns surface at compile time.","Keep the reducer signature and the two system columns in sync with current docs."],"tags":["spacetimedb","proc-macro","scheduled","table","columns","compile-time"],"backgroundTag":"missing-required-column","analyzedSha":"6dee26c6efc2856793e12b148a59742964f5d783","analyzedAt":"2026-08-20T06:08:37.179Z","contentChangedAt":"2026-08-20T06:08:37.179Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}