{"record":{"id":"e9a307664aef1bef","repo":"clockworklabs/SpacetimeDB","slug":"scheduled-tables-must-have-a-primary-key-aut","errorCode":null,"errorMessage":"scheduled tables must have a `#[primary_key] #[auto_inc] scheduled_id: u64` column","messagePattern":"scheduled tables must have a `#\\[primary_key\\] #\\[auto_inc\\] scheduled_id: u64` column","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"crates/bindings-macro/src/table.rs","lineNumber":1104,"sourceCode":"                return Err(syn::Error::new(\n                    sched.span,\n                    \"scheduled table missing required columns; add these to your struct:\\n\\\n                             #[primary_key]\\n\\\n                             #[auto_inc]\\n\\\n                             scheduled_id: u64,\\n\\\n                             scheduled_at: spacetimedb::ScheduleAt,\",\n                ));\n            }\n            let scheduled_at_column = scheduled_at_column.ok_or_else(|| {\n                syn::Error::new(\n                    sched.span,\n                    \"scheduled tables must have a `scheduled_at: spacetimedb::ScheduleAt` column. \\\n                             if the column has a name besides `scheduled_at`, you can specify it with \\\n                             `scheduled(my_reducer, at = custom_scheduled_at)`\",\n                )\n            })?;\n            let primary_key_column = primary_key_column.ok_or_else(|| {\n                syn::Error::new(\n                    sched.span,\n                    \"scheduled tables must have a `#[primary_key] #[auto_inc] scheduled_id: u64` column\",\n                )\n            })?;\n\n            let reducer_or_procedure = &sched.reducer_or_procedure;\n            let scheduled_at_id = scheduled_at_column.index;\n            let desc = quote!(spacetimedb::table::ScheduleDesc {\n                reducer_or_procedure_name: <#reducer_or_procedure as spacetimedb::rt::FnInfo>::NAME,\n                scheduled_at_column: #scheduled_at_id,\n            });\n\n            let primary_key_ty = primary_key_column.ty;\n            let scheduled_at_ty = scheduled_at_column.ty;\n            let typecheck = quote! {\n                spacetimedb::rt::scheduled_typecheck::<\n                    #original_struct_ident,\n                    <#reducer_or_procedure as spacetimedb::rt::FnInfo>::FnKind,","sourceCodeStart":1086,"sourceCodeEnd":1122,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/bindings-macro/src/table.rs#L1086-L1122","documentation":"Scheduled-table validation found a `scheduled_at` time column but no `#[primary_key] #[auto_inc] scheduled_id: u64` column, which the scheduler requires as its handle. The error is emitted at the `scheduled` argument's span and names the exact required column, attributes, and type.","triggerScenarios":"A scheduled table where `scheduled_at` (or an `at = ...` column) resolves but no primary-key column exists.","commonSituations":"Removing or renaming `scheduled_id`, or forgetting the `#[primary_key]`/`#[auto_inc]` attributes when hand-writing a scheduled table.","solutions":["Add `#[primary_key] #[auto_inc] scheduled_id: u64` to the struct","If the id column was renamed, restore the name `scheduled_id`","Ensure all three requirements are present: both attributes and the `u64` type"],"exampleFix":"// before\n#[spacetimedb::table(accessor = reminders, scheduled(run_reminders))]\nstruct Reminders {\n    scheduled_at: spacetimedb::ScheduleAt,\n    note: String,\n}\n\n// after\n#[spacetimedb::table(accessor = reminders, scheduled(run_reminders))]\nstruct Reminders {\n    #[primary_key]\n    #[auto_inc]\n    scheduled_id: u64,\n    scheduled_at: spacetimedb::ScheduleAt,\n    note: String,\n}","handlingStrategy":"validation","validationCode":"# scheduled tables missing the id column\ngrep -rl 'scheduled(' src/ | xargs -r grep -L 'scheduled_id' || echo OK","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always include `#[primary_key] #[auto_inc] scheduled_id: u64` in scheduled tables","Do not rename scheduled_id — the scheduler requires the standard shape","Start from the template rather than hand-writing scheduler schemas"],"tags":["rust","proc-macro","spacetimedb","scheduled-table","compile-time"],"backgroundTag":"missing-required-schema-fields","analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}