{"record":{"id":"8cca7055c68256bd","repo":"facebook/relay","slug":"expected-presence-of-page-info-field-to-have-been","errorCode":null,"errorMessage":"Expected presence of page_info field to have been previously validated.","messagePattern":"Expected presence of page_info field to have been previously validated\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"compiler/crates/relay-transforms/src/transform_connections.rs","lineNumber":249,"sourceCode":"                        value: arg.value.clone(),\n                    });\n                }\n            }\n            transformed_edges_field.directives.push(Directive {\n                name: WithLocation::new(\n                    connection_directive.name.location,\n                    self.defer_stream_interface.stream_name,\n                ),\n                arguments,\n                data: None,\n                location: connection_directive.location,\n            });\n        }\n\n        // Construct page_info selection\n        let page_info_schema_field_id = schema\n            .named_field(connection_field_type, self.connection_interface.page_info)\n            .expect(\"Expected presence of page_info field to have been previously validated.\");\n        let page_info_schema_field = schema.field(page_info_schema_field_id);\n        let page_info_field_name = page_info_schema_field.name.item;\n        let page_info_type = page_info_schema_field.type_.inner();\n        let mut page_info_ix = None;\n        let mut is_aliased_page_info = false;\n        let mut transformed_page_info_field = match page_info_selection {\n            Some((ix, page_info_field)) => {\n                page_info_ix = Some(ix);\n                if let Some(alias) = page_info_field.alias {\n                    // The page_info selection has to be generated as non-aliased field (since product\n                    // code may be accessing the non-aliased response keys).\n                    if alias.item != page_info_field_name {\n                        is_aliased_page_info = true;\n                        // If an alias is present, and it is different from the field name,\n                        // we need to build a new page_info field\n                        LinkedField {\n                            alias: None,\n                            definition: WithLocation::generated(page_info_schema_field_id),","sourceCodeStart":231,"sourceCodeEnd":267,"githubUrl":"https://github.com/facebook/relay/blob/668b1b85e06261aa3b58dabfc51f8b5524a70955/compiler/crates/relay-transforms/src/transform_connections.rs#L231-L267","documentation":"Same pattern as the edges lookup: while building the page_info selection for a @connection field the compiler expects schema.named_field(connection_field_type, self.connection_interface.page_info) to succeed, relying on prior connection validation. A missing page_info field on the connection type panics.","triggerScenarios":"A @connection field whose connection type lacks the page_info field (or the field is named differently than the configured ConnectionInterface.page_info) when the validation pass did not reject it first.","commonSituations":"Custom pageInfo/page_info naming mismatch with ConnectionInterface config; server schemas that omit pageInfo; stale relay compiler config after a schema rename.","solutions":["Add a pageInfo: PageInfo! field to the connection type in your schema.","Align the ConnectionInterface config's page_info name with your schema (e.g. \"pageInfo\").","Ensure the connection validation transform runs before transform_connections.","Regenerate/refresh the local schema snapshot if it is out of date."],"exampleFix":"// before\ntype UserConnection { edges: [UserEdge!]! }\n// after\ntype UserConnection { edges: [UserEdge!]!, pageInfo: PageInfo! }","handlingStrategy":"validation","validationCode":"if schema.named_field(conn_type, \"pageInfo\").is_none() {\n    return Err(Diagnostic::error(format!(\"@connection type {:?} has no pageInfo field\", conn_type)));\n}","typeGuard":"fn has_page_info(schema: &Schema, t: Type, ci: &ConnectionInterface) -> bool {\n    schema.named_field(t.inner(), ci.page_info).is_some()\n}","tryCatchPattern":"let Some(pi_id) = schema.named_field(connection_field_type, self.connection_interface.page_info) else {\n    return Err(Diagnostic::error(\"connection field missing pageInfo\"));\n};","preventionTips":["Add pageInfo: PageInfo! to all connection types.","Refresh schema snapshots after server renames.","Validate connections before transforming them."],"tags":["relay-compiler","connections","schema"],"backgroundTag":"invalid-connection-field","analyzedSha":"668b1b85e06261aa3b58dabfc51f8b5524a70955","analyzedAt":"2026-09-02T19:57:20.783Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T02:17:09.455Z"}