clockworklabs/SpacetimeDB · error

Failed to serialize templates JSON

Error message

Failed to serialize templates JSON

What it means

Error "Failed to serialize templates JSON" thrown in clockworklabs/SpacetimeDB.

Source

Thrown at crates/cli/build.rs:248

            templates.push(TemplateInfo {
                id: template_name.to_string(),
                description: metadata.description,
                server_source,
                client_source,
                server_lang: metadata.server_lang,
                client_lang: metadata.client_lang,
                client_framework: metadata.client_framework,
            });
        }
    }

    templates.sort_by(|a, b| a.id.cmp(&b.id));
    templates
}

fn generate_templates_json(templates: &[TemplateInfo]) -> String {
    let payload = TemplatesJson { templates };
    serde_json::to_string_pretty(&payload).expect("Failed to serialize templates JSON")
}

fn serialize_option_string_as_empty<S>(value: &Option<String>, serializer: S) -> Result<S::Ok, S::Error>
where
    S: serde::Serializer,
{
    serializer.serialize_str(value.as_deref().unwrap_or(""))
}

fn generate_template_entry(code: &mut String, template_path: &Path, source: &str, manifest_dir: &Path) {
    let (git_files, resolved_base) = get_git_tracked_files(template_path, manifest_dir);

    if git_files.is_empty() {
        panic!("Template '{}' has no git-tracked files! Check that the directory exists and contains files tracked by git.", source);
    }

    let repo_root = get_repo_root();

View on GitHub (pinned to 524b4487d9)

When it happens

Trigger: Thrown at crates/cli/build.rs:248 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of clockworklabs/SpacetimeDB@524b4487d9 (2026-08-16). Data as JSON: /api/errors/ab443b966ca4ae98. Report an issue: GitHub.