{"record":{"id":"a99fde92f8df8dc1","repo":"neondatabase/neon","slug":"id-mismatch-identity-toml-id-identity-toml-id-p","errorCode":null,"errorMessage":"id mismatch: identity.toml:id={identity_toml_id} pageserver_(.*) id={id}","messagePattern":"id mismatch: identity\\.toml:id=(.+?) pageserver_\\(\\.\\*\\) id=(.+?)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"control_plane/src/local_env.rs","lineNumber":769,"sourceCode":"                        .with_context(|| format!(\"read {identity_toml_path:?}\"))?,\n                )\n                .context(\"parse identity.toml\")?;\n                let PageserverConfigTomlSubset {\n                    listen_pg_addr,\n                    listen_http_addr,\n                    listen_https_addr,\n                    listen_grpc_addr,\n                    pg_auth_type,\n                    http_auth_type,\n                    grpc_auth_type,\n                    no_sync,\n                } = config_toml;\n                let IdentityTomlSubset {\n                    id: identity_toml_id,\n                } = identity_toml;\n                let conf = PageServerConf {\n                    id: {\n                        anyhow::ensure!(\n                            identity_toml_id == id,\n                            \"id mismatch: identity.toml:id={identity_toml_id} pageserver_(.*) id={id}\",\n                        );\n                        id\n                    },\n                    listen_pg_addr,\n                    listen_http_addr,\n                    listen_https_addr,\n                    listen_grpc_addr,\n                    pg_auth_type,\n                    http_auth_type,\n                    grpc_auth_type,\n                    no_sync,\n                };\n                pageservers.push(conf);\n            }\n            pageservers\n        };","sourceCodeStart":751,"sourceCodeEnd":787,"githubUrl":"https://github.com/neondatabase/neon/blob/8f60b04da47ffefe0e52bda2440134b42874eb75/control_plane/src/local_env.rs#L751-L787","documentation":"Every pageserver datadir records its node id in identity.toml, and the directory itself is named pageserver_<id>. When LocalEnv rebuilds its config from disk it parses both and requires them to match; a mismatch means the directory layout and the node's own identity disagree, which would break routing, so env setup bails.","triggerScenarios":"Renaming a pageserver datadir (e.g. pageserver_1 to pageserver_2) without editing identity.toml, copying a datadir to a new name, restoring a backup into a differently numbered directory, or hand-editing the id field in identity.toml.","commonSituations":"Manual datadir surgery to work around numbering issues, restoring an env from a snapshot, or migrating an env where node numbering changed between versions.","solutions":["Make the ids agree: either rename the directory back to pageserver_<identity.toml id> or update id in identity.toml to the directory's number","If the datadir's provenance is unclear, destroy and re-init the env rather than guessing","Add/remove pageservers only through the neon CLI so naming and identity.toml stay in sync"],"exampleFix":"# before\n.neon/pageserver_2/identity.toml contains: id = 1\n# after\n# either rename the dir back to pageserver_1, or set id = 2 in identity.toml","handlingStrategy":"validation","validationCode":"fn check_identity_matches_dir(datadir: &std::path::Path, id_from_dir: i64) -> anyhow::Result<()> {\n    let toml: toml::Value = toml::from_str(&std::fs::read_to_string(datadir.join(\"identity.toml\"))?)?;\n    let id: i64 = toml.get(\"id\").and_then(|v| v.as_integer()).context(\"identity.toml missing id\")?;\n    anyhow::ensure!(id == id_from_dir, \"identity.toml id {id} != dir id {id_from_dir}\");\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always add/remove pageservers via the neon CLI","If you copy a datadir, update identity.toml's id to match the new directory name","Never renumber pageserver directories by hand"],"tags":["rust","neon-local","pageserver","config","local-env"],"backgroundTag":"config-id-mismatch","analyzedSha":"8f60b04da47ffefe0e52bda2440134b42874eb75","analyzedAt":"2026-08-16T23:39:28.135Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}