facebook/relay · error
mango not found
Error message
mango not found
What it means
Panic from `.expect("mango not found")` in `test_object_fields_sorted_alphabetically` (compiler/crates/schema-set/src/build_schema_document.rs:963), same test as error 163. The printed SDL does not contain the `mango` field substring, so the alphabetical-ordering assertion (apple < mango < zebra) cannot proceed. The library panics because a missing field means either the printer dropped it or the input SDL no longer contains it.
Source
Thrown at compiler/crates/schema-set/src/build_schema_document.rs:963
assert!(
interface_pos < extension_pos,
"Definitions should print before extensions: {}",
sdl,
);
}
#[test]
fn test_object_fields_sorted_alphabetically() {
let sdl = schema_sdl(indoc! {r#"
type Foo {
zebra: String
apple: Int
mango: Boolean
}
"#});
// Fields should be sorted alphabetically
let apple_pos = sdl.find("apple").expect("apple not found");
let mango_pos = sdl.find("mango").expect("mango not found");
let zebra_pos = sdl.find("zebra").expect("zebra not found");
assert!(
apple_pos < mango_pos && mango_pos < zebra_pos,
"Fields should be sorted: {}",
sdl,
);
}
// --- Interface ---
#[test]
fn test_interface_with_fields() {
let sdl = schema_sdl(indoc! {r#"
interface Node {
id: ID!
}
"#});
assert!(sdl.contains("interface Node"), "Got: {}", sdl);View on GitHub (pinned to 668b1b85e0)
Solutions
- Dump the `sdl` string before the `.find` calls and confirm which fields are actually printed.
- Verify the test SDL still declares `mango: Boolean` with exact spelling/casing.
- Fix the printer in build_schema_document.rs if object fields are being omitted, then re-run `cargo test -p schema-set`.
- Harden the assertions with `.unwrap_or_else(|| panic!(... sdl ...))` so output is shown on any future miss.
Example fix
// before
let mango_pos = sdl.find("mango").expect("mango not found");
// after
let mango_pos = sdl
.find("mango")
.unwrap_or_else(|| panic!("mango not found in SDL:\n{}", sdl)); Defensive patterns
Strategy: validation
Validate before calling
// Validate presence of every field before ordering assertions:
assert!(sdl.contains("mango"), "SDL missing 'mango'\n{}", sdl); Type guard
fn sdl_field_position<'a>(sdl: &'a str, field: &str) -> Option<usize> {
sdl.find(field)
} Try / catch
let mango_pos = sdl
.find("mango")
.unwrap_or_else(|| panic!("mango not found; SDL:\n{}", sdl)); Prevention
- Verify exact field spelling/case in the fixture SDL matches the `.find` argument.
- Embed the SDL in the assertion message so drops are visible immediately.
- Re-run schema-set tests after any printer ordering change since these assertions are position-sensitive.
- Prefer asserting on structured printer output (if an API exists) over raw substring positions when possible.
When it happens
Trigger: Same as error 163: `to_sdl_definition()` output for `type Foo { zebra: String apple: Int mango: Boolean }` lacks `mango`. Also occurs if `mango` was renamed or the printer emits fields in a way that renames/escapes them.
Common situations: Field-dropping regression in the SDL printer; editing the test's `indoc!` SDL and forgetting to update all three lookup strings; case sensitivity issues (`Mango` vs `mango`) after a naming-convention change.
Related errors
AI-assisted analysis of facebook/relay@668b1b85e0 (2026-09-02).
Data as JSON: /api/errors/96d4a38f25a7894c.
Report an issue: GitHub.