scripts/cast-selection-dialog.mjs:331-354:
export async function showCastSelectionIfNeeded(socketClient, scriptId, adventureName) {
if (!game.user.isGM) return true;
const result = await CastSelectionDialog.show(socketClient, scriptId, adventureName);
if (!result) return false; // user cancelled
if (result.assignments.length > 0) {
try {
await socketClient.bulkUpdateCharacters(scriptId, result.assignments);
} catch (error) {
console.error(`${MODULE_ID} | Failed to save character assignments:`, error);
ui.notifications.error('Failed to save character assignments');
// ⚠️ falls through, returns true
}
}
return true;
}
Callers in scripts/content-manager.mjs:1434, 1472 treat the true return as "cast selection succeeded, proceed to activate the adventure":
const proceed = await showCastSelectionIfNeeded(...);
if (!proceed) { /* abort */ return; }
await this.socketClient.setActiveAdventure(...);
Consequence: when bulkUpdateCharacters throws, the user sees an error toast for the save, then the adventure activates anyway — but with no character assignments. The state is silently inconsistent: the GM thinks they assigned players to PCs, the server doesn't have the assignments, and the adventure is now live.
Suggested fix: return false (or throw, and let the caller decide) on save failure. Optionally retry the save before giving up. The "user cancelled" path and the "save failed" path should not both report true.
scripts/cast-selection-dialog.mjs:331-354:Callers in
scripts/content-manager.mjs:1434, 1472treat thetruereturn as "cast selection succeeded, proceed to activate the adventure":Consequence: when
bulkUpdateCharactersthrows, the user sees an error toast for the save, then the adventure activates anyway — but with no character assignments. The state is silently inconsistent: the GM thinks they assigned players to PCs, the server doesn't have the assignments, and the adventure is now live.Suggested fix: return
false(or throw, and let the caller decide) on save failure. Optionally retry the save before giving up. The "user cancelled" path and the "save failed" path should not both reporttrue.