You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
serverpod start: adding a future call with parameters generates code that imports a model file that is never written #5760
Generation reports success, then compilation fails:
lib/src/generated/protocol.dart:16:8: Error: Error when reading 'lib/src/generated/future_calls_generated_models/reminder_future_call_remind_model.dart': The system cannot find the path specified
lib/src/generated/future_calls.dart:202:28: Error: Type '_iwnpdk7f.ReminderFutureCallRemindModel' not found.
protocol.dart and future_calls.dart reference ReminderFutureCallRemindModel, but lib/src/generated/future_calls_generated_models/ is never created. Every subsequent save hits the same compile error until a .spy.yaml is touched or serverpod generate is run manually. A future call without parameters is unaffected.
Cause
performGenerate only writes future call parameter models when requirements.generateModels is set (analyzers.dart):
if (requirements.generateModels && futureCallModels.isNotEmpty) {
generatedModelFiles =awaitServerpodCodeGenerator.generateSerializableModels(...)
Watch mode sets generateModels: event.modelFiles.isNotEmpty (watch_session.dart:349), which is false for a .dart-only change. A future call with parameters is a model change that arrives via a Dart file, so the gate skips it while the protocol generation that follows still references the model.
Confirmed on a clean main (5410f87) by driving Analyzers.update + Analyzers.performGenerate the way watch mode does:
generateModels: false -> success=true, protocol.dart imports the model, future_calls_generated_models/ does not exist
generateModels: true -> success=true, future_calls_generated_models/reminder_future_call_remind_model.dart written
As discussed, the fix for this issue will be the replacement of the heuristics we use inside the serverpod_cli to validate whether we should generate or not (like the presence of the strings "Endpoint" or "FutureCall") by a proper analysis of the changed files. It can be a bit slower in cases where multiple files change at once (like when a folder with many files is moved or renamed), but it is a tradeoff of speed for safety. Also, with the analysis server already loaded (after first cycle), it shouldn't represent a significative slowdown.
Activity
marcelomendoncasoares commentedon Sep 24, 2026
As discussed, the fix for this issue will be the replacement of the heuristics we use inside the
serverpod_clito validate whether we should generate or not (like the presence of the strings "Endpoint" or "FutureCall") by a proper analysis of the changed files. It can be a bit slower in cases where multiple files change at once (like when a folder with many files is moved or renamed), but it is a tradeoff of speed for safety. Also, with the analysis server already loaded (after first cycle), it shouldn't represent a significative slowdown.