BigPizzaV3/CodexPlusPlus · error
Dream Skin theme config exceeds 256 KiB
Error message
Dream Skin theme config exceeds 256 KiB
What it means
save_dream_skin_theme serializes the theme's config to pretty JSON and refuses to write it if it exceeds THEME_CONFIG_LIMIT (256 KiB), staging first and aborting the whole save on failure. This keeps on-disk theme configs bounded and prevents bloated or hostile configs from being persisted.
Solutions
- Trim the config: move large payloads (images, big CSS/data blobs) out of config into separate files (the image already is one)
- Minify CSS and remove redundant fields from DreamSkinThemeConfig to shrink the serialized JSON
- If a legitimate theme truly needs more space, raise THEME_CONFIG_LIMIT consciously (keeping load-side validation in sync)
- Compress or strip whitespace — note pretty-printing adds bytes; storage uses to_vec_pretty so size gains must come from content, not formatting
Example fix
// before
config.custom_css = std::fs::read_to_string("huge_theme.css").unwrap(); // 300 KiB
// after
let css = std::fs::read_to_string("theme.css").unwrap();
config.custom_css = minify_css(&css); // ensure serialized config stays < 256 KiB Defensive patterns
Strategy: validation
Validate before calling
let config_bytes = serde_json::to_vec_pretty(&draft.config)?;
if config_bytes.len() as u64 > THEME_CONFIG_LIMIT {
return Err(anyhow::anyhow!(
"theme config is {} bytes; max is {} — move large data out of config",
config_bytes.len(), THEME_CONFIG_LIMIT
));
} Try / catch
match save_dream_skin_theme(&state_dir, draft) {
Ok(()) => {},
Err(e) if e.to_string().contains("256 KiB") => warn_user("config too large: shrink CSS / remove embedded blobs"),
Err(e) => return Err(e.into()),
} Prevention
- Keep images out of the config (they belong in image.<ext> files)
- Minify CSS and drop default/empty fields from serialized configs
- Enforce a soft client-side size warning well below 256 KiB
When it happens
Trigger: Calling save_dream_skin_theme (directly or via create_dream_skin_theme_from_image / rename_dream_skin_theme) where serde_json::to_vec_pretty(&draft.config) yields more than 256 KiB — i.e. a config carrying huge embedded data (e.g. base64 blobs, massive CSS or metadata fields).
Common situations: A user pastes a giant custom CSS block into the theme config; tooling embeds an image as base64 in config instead of the image file; an imported theme JSON from elsewhere contains oversized fields.
Understand the failure class
Background: "File too large" / "file size exceeds limit" errors: why libraries cap file sizes and how to fix them — this error's family across 46 libraries.
Related errors
- 主题包必须是 32 MiB 以内的普通 ZIP 文件
- 官方混合 API 不应在 auth.json 中保存 OPENAI_API_KEY。请清理此供应商的…
- 请填写 API 的模型名称
- Base URL 不能为空
- 上游 Base URL 不能为空
AI-assisted analysis of BigPizzaV3/CodexPlusPlus@b1ed92e5e4 (2026-09-19).
Data as JSON: /api/errors/c0defb3f96de1057.
Report an issue: GitHub.
Appendix: source
Thrown at crates/codex-plus-core/src/dream_skin_library.rs:283
"failed to create theme staging directory {}",
staging.display()
)
})?;
let staged = (|| -> anyhow::Result<()> {
if draft.image_path.trim().is_empty() {
let (_, bytes) = crate::assets::dream_skin_default_image();
crate::settings::atomic_write(&staging.join("image.png"), bytes)?;
} else {
crate::dream_skin::prepare_dream_skin_image_for_directory(
Path::new(draft.image_path.trim()),
&staging,
"image",
)?;
}
let config = serde_json::to_vec_pretty(&draft.config)?;
if config.len() as u64 > THEME_CONFIG_LIMIT {
bail!("Dream Skin theme config exceeds 256 KiB");
}
crate::settings::atomic_write(&staging.join(THEME_CONFIG_FILE), &config)?;
Ok(())
})();
if let Err(error) = staged {
let _ = remove_known_theme_directory(&staging);
return Err(error);
}
let target = themes_dir.join(&draft.config.id);
replace_theme_directory(&staging, &target, &suffix)?;
let stored = load_stored_dream_skin_theme(state_dir, &draft.config.id)?;
Ok(summary_from_draft(&stored, false, false))
}
pub fn save_validated_dream_skin_package(
state_dir: &Path,
package: &crate::dream_skin_package::ValidatedDreamSkinPackage,View on GitHub (pinned to b1ed92e5e4)