affaan-m/ECC · error
candidate configuration exceeds 1 MiB
Error message
candidate configuration exceeds 1 MiB
What it means
`CandidateSpec::new` serializes the candidate configuration to its canonical JSON form and enforces a hard 1 MiB (1024*1024 bytes) limit on the serialized string. Oversized configurations are rejected eagerly because they would bloat persisted artifacts and content-addressed IDs. The error means your `config` JSON value, once canonicalized, exceeds that size budget.
Solutions
- Shrink the config: remove bulky fields and reference external artifacts by path instead of inlining content (use trace_refs/evidence_refs for references).
- Split the candidate into multiple smaller CandidateSpecs if the content genuinely needs to be large.
- Compress or deduplicate repeated structures in the config before passing it in.
- If the limit is too restrictive for your legitimate workload, raise the bound in `harness_eval.rs` deliberately (a library change, not a caller workaround).
Example fix
// before
let config = serde_json::json!({
"fixtures": large_fixture_json, // >1 MiB inlined
});
let spec = CandidateSpec::new(config, trace_refs, evidence_refs)?;
// after
let config = serde_json::json!({
"fixtures_ref": "artifacts/fixtures.json", // external reference
});
let spec = CandidateSpec::new(config, trace_refs, evidence_refs)?; Defensive patterns
Strategy: validation
Validate before calling
fn config_size_ok(config: &serde_json::Value) -> bool {
let canonical = serde_json::to_string(&canonicalize(config.clone())).unwrap_or_default();
canonical.len() <= 1024 * 1024
} Try / catch
match CandidateSpec::new(config, trace_refs, evidence_refs) {
Ok(s) => s,
Err(e) if e.to_string().contains("exceeds 1 MiB") => {
eprintln!("Config too large; move bulky data to external refs");
CandidateSpec::new(shrink_config(config), trace_refs, evidence_refs)?
}
Err(e) => return Err(e),
} Prevention
- Check serialized config size in dev/test before submitting candidates.
- Store large fixtures and datasets as external files referenced via trace_refs/evidence_refs.
- Ban blob-like fields (logs, base64 assets) from candidate configs by convention.
- Set an alerting lint threshold below 1 MiB (e.g. 800 KiB) to catch growth early.
When it happens
Trigger: Constructing a `CandidateSpec::new(config, trace_refs, evidence_refs)` whose `config` `serde_json::Value` canonicalizes to more than 1,048,576 bytes.
Common situations: Embedding large blobs (test fixtures, logs, datasets, base64 assets) directly in the candidate config instead of external file references; accidentally serializing an entire database dump or full environment object; accumulating many nested overrides from merged config layers.
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
- application config exceeds local size limit
- input_artifacts must be a list of local paths
- Invalid at : expected a JSON object
- missing orchestration template variable(s)
- orchestration template
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/4ea6f68f8a57e405.
Report an issue: GitHub.
Appendix: source
Thrown at ecc2/src/harness_eval.rs:198
use serde_json::Value;
use sha2::{Digest, Sha256};
use std::collections::{BTreeMap, BTreeSet};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct CandidateSpec {
pub id: String,
pub canonical_config: String,
pub trace_refs: Vec<String>,
pub evidence_refs: Vec<String>,
}
impl CandidateSpec {
pub fn new(config: Value, trace_refs: Vec<String>, evidence_refs: Vec<String>) -> Result<Self> {
let trace_refs = normalize_refs("trace", trace_refs)?;
let evidence_refs = normalize_refs("evidence", evidence_refs)?;
let canonical_config = serde_json::to_string(&canonicalize(config))?;
if canonical_config.len() > 1024 * 1024 {
bail!("candidate configuration exceeds 1 MiB");
}
let artifact = serde_json::to_string(&CanonicalCandidateArtifact {
config: serde_json::from_str(&canonical_config)?,
trace_refs: &trace_refs,
evidence_refs: &evidence_refs,
})?;
let id = sha256_hex(artifact.as_bytes());
Ok(Self {
id,
canonical_config,
trace_refs,
evidence_refs,
})
}
pub fn verify_integrity(&self) -> Result<()> {
self.verify_persisted_id(&self.id)?;
if self.id != self.id_for_v2()? {View on GitHub (pinned to 8321021c54)