{"record":{"id":"94f3a8e15646a563","repo":"linera-io/linera-protocol","slug":"invalid-parsing-of-genericapplicationid","errorCode":null,"errorMessage":"Invalid parsing of GenericApplicationId","messagePattern":"Invalid parsing of GenericApplicationId","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"linera-base/src/identifiers.rs","lineNumber":473,"sourceCode":"                Display::fmt(\"User:\", f)?;\n                Display::fmt(&application_id, f)\n            }\n        }\n    }\n}\n\nimpl std::str::FromStr for GenericApplicationId {\n    type Err = anyhow::Error;\n\n    fn from_str(s: &str) -> Result<Self, Self::Err> {\n        if s == \"System\" {\n            return Ok(GenericApplicationId::System);\n        }\n        if let Some(result) = s.strip_prefix(\"User:\") {\n            let application_id = ApplicationId::from_str(result)?;\n            return Ok(GenericApplicationId::User(application_id));\n        }\n        Err(anyhow!(\"Invalid parsing of GenericApplicationId\"))\n    }\n}\n\nimpl<A> From<ApplicationId<A>> for AccountOwner {\n    fn from(app_id: ApplicationId<A>) -> Self {\n        if app_id.is_evm() {\n            let hash_bytes = app_id.application_description_hash.as_bytes();\n            AccountOwner::Address20(hash_bytes[..20].try_into().unwrap())\n        } else {\n            AccountOwner::Address32(app_id.application_description_hash)\n        }\n    }\n}\n\nimpl From<AccountPublicKey> for AccountOwner {\n    fn from(public_key: AccountPublicKey) -> Self {\n        match public_key {\n            AccountPublicKey::Ed25519(public_key) => public_key.into(),","sourceCodeStart":455,"sourceCodeEnd":491,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-base/src/identifiers.rs#L455-L491","documentation":"GenericApplicationId::from_str accepts exactly two textual forms: the literal 'System' or 'User:<ApplicationId>' (the user application ID in its own Display format). Anything else raises this error. A common confusion is passing a bare application ID without the 'User:' prefix.","triggerScenarios":"Calling parse::<GenericApplicationId>() on a bare application ID like 'e40c...:7019...' (missing 'User:' prefix), a lowercase 'system' (case-sensitive), an empty string, or any other unprefixed value. Note 'User:' with an invalid remainder surfaces ApplicationId's own error instead.","commonSituations":"Glue code that formats the enum by hand; configuration files that store only the application ID; string formats that changed across Linera versions; frontend input passed straight to a GraphQL/API endpoint that parses this type.","solutions":["Prefix user application IDs with 'User:' before parsing","Serialize with GenericApplicationId::to_string() and reuse that exact string","For the system variant pass the exact literal 'System' (capital S)"],"exampleFix":"// before: bare application ID\nlet id: GenericApplicationId = app_id_str.parse()?; // Err\n\n// after: prefixed form\nlet id: GenericApplicationId = format!(\"User:{app_id_str}\").parse()?;","handlingStrategy":"type-guard","validationCode":"fn looks_like_generic_app_id(s: &str) -> bool {\n    s == \"System\" || s.starts_with(\"User:\")\n}","typeGuard":"fn parse_generic_app_id(s: &str) -> Option<GenericApplicationId> {\n    s.parse().ok()\n}","tryCatchPattern":null,"preventionTips":["Always emit the 'User:' prefix when serializing user application IDs by hand","Prefer GenericApplicationId::to_string() as the canonical wire format","Remember 'System' is case-sensitive"],"tags":["parsing","identifier","application-id","linera-base","rust"],"backgroundTag":"invalid-identifier-format","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}