{"record":{"id":"ab443b966ca4ae98","repo":"clockworklabs/SpacetimeDB","slug":"failed-to-serialize-templates-json","errorCode":null,"errorMessage":"Failed to serialize templates JSON","messagePattern":"Failed to serialize templates JSON","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cli/build.rs","lineNumber":248,"sourceCode":"            templates.push(TemplateInfo {\n                id: template_name.to_string(),\n                description: metadata.description,\n                server_source,\n                client_source,\n                server_lang: metadata.server_lang,\n                client_lang: metadata.client_lang,\n                client_framework: metadata.client_framework,\n            });\n        }\n    }\n\n    templates.sort_by(|a, b| a.id.cmp(&b.id));\n    templates\n}\n\nfn generate_templates_json(templates: &[TemplateInfo]) -> String {\n    let payload = TemplatesJson { templates };\n    serde_json::to_string_pretty(&payload).expect(\"Failed to serialize templates JSON\")\n}\n\nfn serialize_option_string_as_empty<S>(value: &Option<String>, serializer: S) -> Result<S::Ok, S::Error>\nwhere\n    S: serde::Serializer,\n{\n    serializer.serialize_str(value.as_deref().unwrap_or(\"\"))\n}\n\nfn generate_template_entry(code: &mut String, template_path: &Path, source: &str, manifest_dir: &Path) {\n    let (git_files, resolved_base) = get_git_tracked_files(template_path, manifest_dir);\n\n    if git_files.is_empty() {\n        panic!(\"Template '{}' has no git-tracked files! Check that the directory exists and contains files tracked by git.\", source);\n    }\n\n    let repo_root = get_repo_root();\n","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/clockworklabs/SpacetimeDB/blob/524b4487d949b61a07d4f39c862d1290259dfd20/crates/cli/build.rs#L230-L266","documentation":"Error \"Failed to serialize templates JSON\" thrown in clockworklabs/SpacetimeDB.","triggerScenarios":"Thrown at crates/cli/build.rs:248 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"524b4487d949b61a07d4f39c862d1290259dfd20","analyzedAt":"2026-08-16T23:58:54.611Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}