{"record":{"id":"84dca964cf31c945","repo":"hasura/graphql-engine","slug":"error-building-metadata","errorCode":null,"errorMessage":"error building metadata","messagePattern":"error building metadata","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v3/crates/engine/src/state.rs","lineNumber":42,"sourceCode":"    let auth_config =\n        hasura_authn::parse_auth_config(raw_auth_config).map_err(StartupError::ReadAuth)?;\n    let (resolved_auth_config, auth_warnings) =\n        hasura_authn::resolve_auth_config(auth_config, flags.as_ref())?;\n\n    let (resolved_metadata, warnings) =\n        metadata_resolve::resolve(metadata, metadata_resolve_configuration).map_err(|error| {\n            let reports = metadata_resolve::to_fancy_errors(\n                opendd_metadata_json,\n                &error,\n                ariadne::Config::new(),\n            );\n            for report in reports {\n                report\n                    .eprint(ariadne::Source::from(opendd_metadata_json))\n                    .unwrap();\n            }\n            // return empty error to stop printing twice\n            anyhow::anyhow!(\"error building metadata\")\n        })?;\n\n    print_warnings(auth_warnings);\n    print_warnings(warnings);\n\n    Ok((resolved_metadata, resolved_auth_config))\n}\n\n/// Build the engine state - include auth, metadata, and jsonapi context.\npub fn build_state(\n    expose_internal_errors: ExposeInternalErrors,\n    auth_config: hasura_authn::ResolvedAuthConfig,\n    resolved_metadata: metadata_resolve::Metadata,\n    auth_mode_header: String,\n    ndc_response_size_limit: usize,\n) -> Result<EngineState, anyhow::Error> {\n    // Metadata\n    let resolved_metadata = Arc::new(resolved_metadata);","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/hasura/graphql-engine/blob/724551b9ae87845594ef0408cff0e50eb6c90dc5/v3/crates/engine/src/state.rs#L24-L60","documentation":"Generic anyhow error returned by engine::resolve_metadata after metadata validation reports have already been printed to stderr via ariadne. The real diagnostic details are in the printed reports; this error exists only to propagate failure (and stop error printing from happening twice), so the message itself carries no detail.","triggerScenarios":"Calling engine::resolve_metadata with an OpenDD metadata JSON that fails validation; the function renders each report against the metadata source and then returns this placeholder error via the ?-operator on the closure result.","commonSituations":"Invalid or malformed metadata documents, schema/argument type mismatches between subgraphs, stale metadata after upgrading engine or connector versions, or hand-edited metadata JSON.","solutions":["Read the ariadne validation reports printed just above this error — they contain the actual problem","Fix the reported metadata issues (types, names, relationships) in the source metadata","Regenerate metadata from your source schemas instead of hand-editing","Pin matching versions of engine/CLI/connector so metadata format matches"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"fn is_metadata_error(e: &anyhow::Error) -> bool { e.to_string().contains(\"error building metadata\") }","tryCatchPattern":"Catch the anyhow error from resolve_metadata, log that detailed ariadne reports were already printed to stderr, and surface a concise 'metadata invalid' message to the operator.","preventionTips":["Run metadata validation as a CI step before deployment","Treat any stderr reports before the error as the real diagnostic","Keep metadata generation automated rather than hand-edited"],"tags":["metadata","validation","graphql-federation","rust"],"backgroundTag":"schema-validation-failed","analyzedSha":"724551b9ae87845594ef0408cff0e50eb6c90dc5","analyzedAt":"2026-08-28T07:32:55.105Z","schemaVersion":2},"datasetVersion":"2026-08-28T11:17:15.048Z"}