{"record":{"id":"56c4a62bc56701fd","repo":"rust-lang/rust-analyzer","slug":"invalid-profile-longer-than","errorCode":null,"errorMessage":"invalid profile longer_than","messagePattern":"invalid profile longer_than","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/rust-analyzer/src/tracing/hprof.rs","lineNumber":235,"sourceCode":"            }\n        }\n        self.children.truncate(idx + 1);\n        for child in &mut self.children {\n            child.aggregate()\n        }\n    }\n}\n\n#[derive(Default, Clone, Debug)]\npub(crate) struct WriteFilter {\n    depth: usize,\n    longer_than: Duration,\n}\n\nimpl WriteFilter {\n    pub(crate) fn from_spec(mut spec: &str) -> (WriteFilter, Option<FxHashSet<String>>) {\n        let longer_than = if let Some(idx) = spec.rfind('>') {\n            let longer_than = spec[idx + 1..].parse().expect(\"invalid profile longer_than\");\n            spec = &spec[..idx];\n            Duration::from_millis(longer_than)\n        } else {\n            Duration::new(0, 0)\n        };\n\n        let depth = if let Some(idx) = spec.rfind('@') {\n            let depth: usize = spec[idx + 1..].parse().expect(\"invalid profile depth\");\n            spec = &spec[..idx];\n            depth\n        } else {\n            999\n        };\n        let allowed = if spec == \"*\" {\n            None\n        } else {\n            Some(FxHashSet::from_iter(spec.split('|').map(String::from)))\n        };","sourceCodeStart":217,"sourceCodeEnd":253,"githubUrl":"https://github.com/rust-lang/rust-analyzer/blob/e8f7e90aa3e7b26aa9a000200f606c1078da99ec/crates/rust-analyzer/src/tracing/hprof.rs#L217-L253","documentation":"rust-analyzer's hprof profiling WriteFilter parses a spec string whose trailing '>' segment is the minimum span duration in milliseconds. If that segment cannot be parsed as an unsigned integer, the expect panics with 'invalid profile longer_than'. This is an input-format validation guard on the profiling filter spec (e.g. PROFILE_TO or similar env-provided spec).","triggerScenarios":"Setting the profiling spec with a '>' suffix whose part after '>' is not a valid integer, e.g. 'profile_name>abc' or an empty suffix 'name>' passed via the profiling filter config/env.","commonSituations":"Typos in the RA_PROFILE env var value (e.g. '...>10m' or '...>ten-ms'); shell quoting mangling the spec so trailing characters get cut; copy-pasting a spec with a trailing '>' but no number.","solutions":["Correct the spec so the part after '>' is a plain integer of milliseconds, e.g. 'profile*>50' means spans longer than 50ms.","Verify the environment variable / config value with `env | grep PROFILE` (or the relevant setting) and fix quoting or truncation.","Consult rust-analyzer tracing docs for the filter grammar: name[@depth][>ms]."],"exampleFix":"// before\nRA_PROFILE=\"*/3>1s>\"       // trailing '>' with no number\n// after\nRA_PROFILE=\"*/3>1000\"     // spans longer than 1000 ms","handlingStrategy":"validation","validationCode":"fn validate_profile_spec(spec: &str) -> Result<(), String> {\n    if let Some(idx) = spec.rfind('>') {\n        spec[idx + 1..].parse::<u64>()\n            .map(|_| ())\n            .map_err(|_| format!(\"invalid longer_than suffix in {spec:?}\"))\n    } else { Ok(()) }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep RA_PROFILE in the documented form name[@depth][>ms]","Quote env values in shells to avoid mangling","Test profiling flags once in a clean shell before saving them in configs"],"tags":["rust-analyzer","tracing","profiling","parsing"],"backgroundTag":"profiling-spec-parse-error","analyzedSha":"e8f7e90aa3e7b26aa9a000200f606c1078da99ec","analyzedAt":"2026-09-03T21:08:06.959Z","contentChangedAt":"2026-09-03T21:08:06.959Z","schemaVersion":2},"datasetVersion":"2026-09-11T07:07:21.782Z"}