{"record":{"id":"a8626642d7475643","repo":"linera-io/linera-protocol","slug":"invalid-application-id","errorCode":null,"errorMessage":"Invalid application ID","messagePattern":"Invalid application ID","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"linera-service/src/cli/main.rs","lineNumber":719,"sourceCode":"                                                existing_policy.maximum_oracle_response_bytes,\n                                            ),\n                                        maximum_http_response_bytes: maximum_http_response_bytes\n                                            .unwrap_or(existing_policy.maximum_http_response_bytes),\n                                        http_request_timeout_ms: http_request_timeout_ms\n                                            .unwrap_or(existing_policy.http_request_timeout_ms),\n                                        http_request_allow_list: http_request_allow_list\n                                            .map(BTreeSet::from_iter)\n                                            .unwrap_or(existing_policy.http_request_allow_list),\n                                        free_application_ids: free_application_ids\n                                            .map(|ids| {\n                                                ids.into_iter().map(|s| s.parse()).collect::<Result<\n                                                    BTreeSet<_>,\n                                                    _,\n                                                >>(\n                                                )\n                                            })\n                                            .transpose()\n                                            .expect(\"Invalid application ID\")\n                                            .unwrap_or(existing_policy.free_application_ids),\n                                        flags: flags\n                                            .map(|values| {\n                                                values\n                                                    .into_iter()\n                                                    .map(|s| s.parse())\n                                                    .collect::<Result<BTreeSet<_>, _>>()\n                                            })\n                                            .transpose()\n                                            .expect(\"Invalid protocol flag\")\n                                            .unwrap_or(existing_policy.flags),\n                                    };\n                                    info!(\"{policy}\");\n                                    if committee.policy() == &policy {\n                                        return Ok(ClientOutcome::Committed(None));\n                                    }\n                                }\n                                _ => unreachable!(),","sourceCodeStart":701,"sourceCodeEnd":737,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-service/src/cli/main.rs#L701-L737","documentation":"While building a ResourceControlPolicy in the linera CLI (free_application_ids field), each --free-application-ids string is parsed with ApplicationId's FromStr and collected into a BTreeSet. The expect panics when any supplied string is not a valid canonical ApplicationId, aborting the policy/command before anything is written.","triggerScenarios":"Passing --free-application-ids with a value that fails ApplicationId::from_str: truncated hex, a bytecode ID or blob hash instead of an application ID, a value with '0x' prefix, whitespace, or a JSON-quoted string.","commonSituations":"Copy-pasting the wrong identifier from `linera query-application` output (which prints bytecode_id, publisher, and application_id separately); hand-truncating the long hex string in scripts; passing IDs from a different network/genesis whose format is not parseable.","solutions":["Copy the exact full application ID string as printed by `linera query-application` (the `application_id` field, plain hex, no 0x, no quotes)","Extract it programmatically instead of by hand: jq -r '.application_id' from JSON output, or use the value returned by publish","Pre-validate each ID in your script before invoking the CLI (parse/regex check for full-length hex)","If parsing still fails, confirm you are on the same network/genesis the application was published to"],"exampleFix":"# before\nlinera ... --free-application-ids 0xe5ab00...  # 0x prefix + truncated\n\n# after\nAPP_ID=$(linera query-application --abi-... | jq -r '.application_id')\nlinera ... --free-application-ids \"$APP_ID\"","handlingStrategy":"validation","validationCode":"# Validate the ID shape before invoking the CLI.\nAPP_ID='...'\nif ! [[ \"$APP_ID\" =~ ^[0-9a-f]{40,}$ ]]; then echo \"not a canonical application id\" >&2; exit 1; fi","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Extract IDs with jq from machine-readable output instead of copy-paste","Keep a single source of truth (env file) for published application IDs per network","Never mix IDs between networks/geneses; tag them in config"],"tags":["linera","cli","application-id","resource-control-policy","parsing"],"backgroundTag":"invalid-identifier-format","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}