Summary
Passing any unrecognized language code via --dvblang causes an unconditional
Rust panic that crashes the entire CCExtractor process with no user-facing error
message.
Location
src/rust/src/common.rs — copy_to_rust(), line ~427
Code
Language::from_str(&c_char_to_string(...)).expect("Invalid language")
Language::from_str() uses strum's EnumString derive. For any string not
in the Language enum (e.g. --dvblang xyz), it returns Err. The .expect()
call converts this into an unconditional panic, crashing the process instead of
printing a helpful CLI error.
Reproduction
ccextractor input.ts --dvblang xyz
# thread 'main' panicked at 'Invalid language', src/rust/src/common.rs:427
Expected Behaviour
CCExtractor should print a diagnostic like:
"Unknown language code 'xyz' — using default" and continue, or exit with a
clean error message.
Suggested Fix
Replace:
Language::from_str(&lang_str).expect("Invalid language")
With either:
// Option A — silent fallback
Language::from_str(&lang_str).unwrap_or_default()
// Option B — user-facing error (preferred)
Language::from_str(&lang_str).unwrap_or_else(|_| {
eprintln!("Warning: unknown language code '{}', using default", lang_str);
Language::default()
})
Environment
- Affects all platforms
- Reproducible with any unrecognized ISO 639 code passed to
--dvblang
Summary
Passing any unrecognized language code via
--dvblangcauses an unconditionalRust panic that crashes the entire CCExtractor process with no user-facing error
message.
Location
src/rust/src/common.rs—copy_to_rust(), line ~427Code
Language::from_str()uses strum'sEnumStringderive. For any string notin the
Languageenum (e.g.--dvblang xyz), it returnsErr. The.expect()call converts this into an unconditional panic, crashing the process instead of
printing a helpful CLI error.
Reproduction
ccextractor input.ts --dvblang xyz # thread 'main' panicked at 'Invalid language', src/rust/src/common.rs:427Expected Behaviour
CCExtractor should print a diagnostic like:
"Unknown language code 'xyz' — using default"and continue, or exit with aclean error message.
Suggested Fix
Replace:
With either:
Environment
--dvblang