{"record":{"id":"0f5edc9d3b22d3c6","repo":"sharkdp/hexyl","slug":"failed-to-parse-skip-arg-as-byte-count","errorCode":null,"errorMessage":"failed to parse `--skip` arg {:?} as byte count","messagePattern":"failed to parse `--skip` arg (.+?) as byte count","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/main.rs","lineNumber":326,"sourceCode":"    }\n    let (num, unit) = extract_num_and_unit_from(&opt.block_size)?;\n    if let Unit::Block { custom_size: _ } = unit {\n        return Err(anyhow!(\n            \"can not use 'block(s)' as a unit to specify block size\"\n        ));\n    };\n    let block_size = num\n        .checked_mul(unit.get_multiplier())\n        .ok_or_else(|| anyhow!(ByteOffsetParseError::UnitMultiplicationOverflow))\n        .and_then(|x| {\n            PositiveI64::new(x).ok_or_else(|| anyhow!(\"block size argument must be positive\"))\n        })?;\n\n    let skip_arg = opt\n        .skip\n        .as_ref()\n        .map(|s| {\n            parse_byte_offset(s, block_size).context(anyhow!(\n                \"failed to parse `--skip` arg {:?} as byte count\",\n                s\n            ))\n        })\n        .transpose()?;\n\n    let skip_offset = if let Some(ByteOffset { kind, value }) = skip_arg {\n        let value = value.into_inner();\n        reader\n            .seek(match kind {\n                ByteOffsetKind::ForwardFromBeginning | ByteOffsetKind::ForwardFromLastOffset => {\n                    SeekFrom::Current(value)\n                }\n                ByteOffsetKind::BackwardFromEnd => SeekFrom::End(value.checked_neg().unwrap()),\n            })\n            .map_err(|_| {\n                anyhow!(\n                    \"Failed to jump to the desired input position. \\","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/sharkdp/hexyl/blob/6ecc29b9c8c84d08a7e860f7f69c22b113b480ea/src/main.rs#L308-L344","documentation":"The --skip argument is parsed as a byte offset relative to the block size via parse_byte_offset; any parse failure is wrapped in context 'failed to parse `--skip` arg ... as byte count'.","triggerScenarios":"--skip with a malformed value such as --skip 12x, --skip abc, --skip 1.5, or a unit not recognized by parse_byte_offset.","commonSituations":"Typos in unit suffixes ('kib' vs 'KiB' style mistakes); passing human strings like '1MB ' with spaces; negative decimals; mixing up --skip with grep-like line semantics.","solutions":["Use a valid byte-count expression, e.g. --skip 1024, 4k, 2blocks, or -1024","Check accepted unit suffixes and remove stray characters/spaces","Read the inner parse error printed below the context message for the exact position that failed"],"exampleFix":"// before\nb3sum --skip 10kb file\n// after\nb3sum --skip 10k file","handlingStrategy":"validation","validationCode":"[[ \"$skip\" =~ ^-?[0-9]+(k|KiB|M|MiB|G|GiB|blocks?)?$ ]] || { echo \"bad --skip: $skip\" >&2; exit 1; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only documented unit suffixes","Avoid spaces and fractional values","Read the nested parse error for the exact bad position"],"tags":["cli","parsing","invalid-argument"],"backgroundTag":"invalid-argument-format","analyzedSha":"6ecc29b9c8c84d08a7e860f7f69c22b113b480ea","analyzedAt":"2026-09-09T22:34:15.450Z","contentChangedAt":"2026-09-09T22:34:15.450Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}