{"record":{"id":"651d44f11dc17f60","repo":"clockworklabs/SpacetimeDB","slug":"uuid-v4-requires-16-bytes","errorCode":null,"errorMessage":"UUID v4 requires 16 bytes","messagePattern":"UUID v4 requires 16 bytes","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"crates/bindings-typescript/src/lib/uuid.ts","lineNumber":103,"sourceCode":"   * 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);\n   *\n   * console.assert(\n   *   uuid.toString() === \"00000000-0000-4000-8000-000000000000\"\n   * );\n   * ```\n   */\n  static fromRandomBytesV4(bytes: Uint8Array): Uuid {\n    if (bytes.length !== 16) throw new Error('UUID v4 requires 16 bytes');\n    const arr = new Uint8Array(bytes);\n    arr[6] = (arr[6] & 0x0f) | 0x40; // version 4\n    arr[8] = (arr[8] & 0x3f) | 0x80; // variant\n    return new Uuid(Uuid.bytesToBigInt(arr));\n  }\n\n  /**\n   * Generate a UUID `v7` using a monotonic counter from `0` to `2^31 - 1`,\n   * a timestamp, and 4 random bytes.\n   *\n   * The counter wraps around on overflow.\n   *\n   * The UUID `v7` is structured as follows:\n   *\n   * ```ascii\n   * ┌───────────────────────────────────────────────┬───────────────────┐\n   * | B0  | B1  | B2  | B3  | B4  | B5              |         B6        |\n   * ├───────────────────────────────────────────────┼───────────────────┤","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/6dee26c6efc2856793e12b148a59742964f5d783/crates/bindings-typescript/src/lib/uuid.ts#L85-L121","documentation":"Same scheduled-table validation, but this branch fires when a primary-key column exists while the scheduled_at column does not: neither a field named scheduled_at nor any column named by scheduled(reducer, at = custom) was found among the struct fields. The error offers both fixes — add the default column or declare a custom one via at = ...","triggerScenarios":"A scheduled table that has the #[primary_key]/#[auto_inc] scheduled_id column but no scheduled_at: spacetimedb::ScheduleAt field, or whose at = custom_at argument names a field that does not exist.","commonSituations":"Renaming scheduled_at without adding at = ...; deleting the column during a refactor; a typo in the at = ... value.","solutions":["Add the field: scheduled_at: spacetimedb::ScheduleAt,","For a custom name: #[spacetimedb::table(scheduled = my_reducer, at = run_at)] plus a run_at: spacetimedb::ScheduleAt field.","Ensure the type is exactly spacetimedb::ScheduleAt."],"exampleFix":"// before\n#[spacetimedb::table(accessor = job, scheduled = run)]\npub struct Job {\n    #[primary_key] #[auto_inc] scheduled_id: u64,\n    pub payload: String,\n}\n\n// after (custom column name)\n#[spacetimedb::table(accessor = job, scheduled = run, at = run_at)]\npub struct Job {\n    #[primary_key] #[auto_inc] scheduled_id: u64,\n    pub run_at: spacetimedb::ScheduleAt,\n    pub payload: String,\n}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Every scheduled table needs a scheduled_at: spacetimedb::ScheduleAt field (or at = ... pointing at one).","When renaming scheduled_at, add at = <new_name> to the scheduled(...) argument in the same change.","Double-check the at = ... value against the actual field ident before building."],"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"}