{"record":{"id":"3a4ab7f094c06026","repo":"can1357/oh-my-pi","slug":"invalid-quoting-style-style","errorCode":null,"errorMessage":"Invalid quoting style: {style}","messagePattern":"Invalid quoting style: (.+?)","errorType":"exception","errorClass":"StatError","httpStatus":null,"severity":"error","filePath":"crates/pi-builtins/src/stat.rs","lineNumber":136,"sourceCode":"-`%b`: total data blocks in file system\n-`%c`: total file nodes in file system\n-`%d`: free file nodes in file system\n-`%f`: free blocks in file system\n-`%i`: file system ID in hex\n-`%l`: maximum length of filenames\n-`%n`: file name\n-`%s`: block size (for faster transfers)\n-`%S`: fundamental block size (for block counts)\n-`%t`: file system type in hex\n-`%T`: file system type in human readable form\n\nNOTE: your shell may have its own version of stat, which usually supersedes\nthe version described here.  Please refer to your shell's documentation\nfor details about the options it supports.\";\n\n\t#[derive(Debug, Error)]\n\tenum StatError {\n\t\t#[error(\"Invalid quoting style: {style}\")]\n\t\tInvalidQuotingStyle { style: String },\n\t\t#[error(\"missing operand\\nTry 'stat --help' for more information.\")]\n\t\tMissingOperand,\n\t\t#[error(\"{directive}: invalid directive\")]\n\t\tInvalidDirective { directive: String },\n\t\t#[error(\"cannot read table of mounted file systems: {error}\")]\n\t\t#[cfg_attr(not(unix), allow(dead_code, reason = \"mount tables are unix-only\"))]\n\t\tCannotReadFilesystem { error: String },\n\t\t#[error(\"using '-' to denote standard input does not work in file system mode\")]\n\t\t#[cfg_attr(not(unix), allow(dead_code, reason = \"stdin filesystem mode is unix-only\"))]\n\t\tStdinFilesystemMode,\n\t\t#[error(\"cannot read file system information for {file}: {error}\")]\n\t\tCannotReadFilesystemInfo { file: String, error: String },\n\t\t#[error(\"cannot stat {file}: {error}\")]\n\t\tCannotStat { file: String, error: String },\n\t}\n\n\tmod options {","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/crates/pi-builtins/src/stat.rs#L118-L154","documentation":"StatError::InvalidQuotingStyle is thrown by the stat builtin when the --printf quoting-style argument is not one of the supported styles. stat validates the requested style before formatting output and rejects unknown values, naming the style that was rejected.","triggerScenarios":"Calling the stat builtin with `--printf=...` and a quoting-style value outside the accepted set (e.g. a typo like 'shelll' instead of 'shell', or an unsupported style string).","commonSituations":"Porting scripts between GNU stat variants with different accepted style vocabularies; typos in long option values; config files storing style names that were valid for another stat implementation.","solutions":["Use one of the supported quoting style values (e.g. literal, shell, c, escape) — correct any typo in the style argument.","Check the stat builtin's help/docs for the exact accepted style names.","Remove the style option if default quoting is acceptable.","Validate the style string in wrapper code before invoking stat."],"exampleFix":"// before\nstat --printf='%n %s' --quoting-style=shelll file.txt\n// after\nstat --printf='%n %s' --quoting-style=shell file.txt","handlingStrategy":"validation","validationCode":"// allow-list of quoting styles accepted by the stat builtin\nconst QUOTING_STYLES = new Set([\"literal\", \"shell\", \"shell-always\", \"c\", \"escape\", \"locale\", \"c-maybe\"]);\nif (style !== undefined && !QUOTING_STYLES.has(style)) {\n  throw new Error(`Invalid quoting style: ${style}`);\n}","typeGuard":"const isQuotingStyle = (s: string): s is \"literal\" | \"shell\" | \"shell-always\" | \"c\" | \"escape\" | \"locale\" =>\n  [\"literal\", \"shell\", \"shell-always\", \"c\", \"escape\", \"locale\"].includes(s);","tryCatchPattern":"try {\n  await stat([\"--quoting-style=\" + style, file]);\n} catch (err) {\n  if (String(err).startsWith(\"Invalid quoting style\")) {\n    await stat([file]); // retry with default quoting\n  } else throw err;\n}","preventionTips":["Keep quoting-style values in a typed constant/enum, never free-form strings.","Validate style values at config-load time in wrapper scripts.","Consult the stat builtin's help for the exact accepted style set.","Test format/option combos after porting scripts between stat implementations."],"tags":["stat","cli","argument-validation","usage-error"],"backgroundTag":"invalid-option-value","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}