{"record":{"id":"78473c9000f865bc","repo":"can1357/oh-my-pi","slug":"invalid-time-style-argument-possible-values-a","errorCode":null,"errorMessage":"invalid --time-style argument {}\nPossible values are:\n  - [posix-]full-iso\n  - [posix-]long-iso\n  - [posix-]iso\n  - [posix-]locale\n  - +FORMAT (e.g., +%H:%M) for a 'date'-style format\n\nFor more information try --help","messagePattern":"invalid --time-style argument (.+?)\nPossible values are:\n  - \\[posix-\\]full-iso\n  - \\[posix-\\]long-iso\n  - \\[posix-\\]iso\n  - \\[posix-\\]locale\n  - \\+FORMAT \\(e\\.g\\., \\+%H:%M\\) for a 'date'-style format\n\nFor more information try --help","errorType":"error_code","errorClass":"LsError","httpStatus":null,"severity":"error","filePath":"crates/pi-builtins/src/ls.rs","lineNumber":3711,"sourceCode":"\t\t},\n\t\t_ => if 9 == .1.raw_os_error().unwrap_or(1) {\n\t\t\tformat!(\"cannot open directory {}: Bad file descriptor\", .0.quote())\n\t\t} else {\n\t\t\tformat!(\"unknown io error: {}, '{:?}'\", .0.quote(), .1)\n\t\t},\n\t})]\n\tIOErrorContext(PathBuf, std::io::Error, bool, bool),\n\n\t#[error(\"invalid --block-size argument '{0}'\")]\n\tBlockSizeParseError(String),\n\n\t#[error(\"--dired and --zero are incompatible\")]\n\tDiredAndZeroAreIncompatible,\n\n\t#[error(\"{}: not listing already-listed directory\", .0.maybe_quote())]\n\tAlreadyListedError(PathBuf),\n\n\t#[error(\"invalid --time-style argument {}\\nPossible values are:\\n  - [posix-]full-iso\\n  - [posix-]long-iso\\n  - [posix-]iso\\n  - [posix-]locale\\n  - +FORMAT (e.g., +%H:%M) for a 'date'-style format\\n\\nFor more information try --help\", .0.quote())]\n\tTimeStyleParseError(String),\n}\n\nimpl LsError {\n\tfn code(&self) -> i32 {\n\t\tmatch self {\n\t\t\tSelf::InvalidLineWidth(_) => 2,\n\t\t\tSelf::IOError(_) => 1,\n\t\t\tSelf::IOErrorContext(_, _, false, _) => 1,\n\t\t\tSelf::IOErrorContext(_, _, true, _) => 2,\n\t\t\tSelf::BlockSizeParseError(_) => 2,\n\t\t\tSelf::DiredAndZeroAreIncompatible => 2,\n\t\t\tSelf::AlreadyListedError(_) => 2,\n\t\t\tSelf::TimeStyleParseError(_) => 2,\n\t\t}\n\t}\n}\n","sourceCodeStart":3693,"sourceCodeEnd":3729,"githubUrl":"https://github.com/can1357/oh-my-pi/blob/969062200754ea02cfac922e5ebb8c608c079e15/crates/pi-builtins/src/ls.rs#L3693-L3729","documentation":"LsError::TimeStyleParseError is raised when the builtin `ls` receives a --time-style value it does not recognize. Accepted values are the GNU set: [posix-]full-iso, [posix-]long-iso, [posix-]iso, [posix-]locale, or a date-style +FORMAT string such as +%H:%M. The message enumerates all valid choices.","triggerScenarios":"Running `ls --time-style=<bad>` where <bad> is a misspelled keyword (e.g. 'longiso' without the dash prefix... actually 'long-iso' is required), a bare keyword missing its posix- prefix variant handling, a +FORMAT without the leading +, or a format with invalid strftime specifiers context.","commonSituations":"Setting TIME_STYLE env var (via /etc/profile or ~/.bashrc) with a value from a different ls implementation (BSD ls uses different keywords), typos like 'iso-locale' or 'LONG-ISO', scripts copied between macOS (BSD ls) and GNU ls.","solutions":["Use one of the exact keywords: full-iso, long-iso, iso, locale (optionally prefixed with posix-)","Ensure a custom format starts with +, e.g. --time-style=+%Y-%m-%d %H:%M","Check the TIME_STYLE environment variable for values inherited from BSD/macOS conventions","Run `ls --help` to confirm supported styles in this build"],"exampleFix":"// before\nls --time-style=longiso\n// after\nls --time-style=long-iso","handlingStrategy":"validation","validationCode":"const TIME_STYLES = new Set(['full-iso','long-iso','iso','locale',\n  'posix-full-iso','posix-long-iso','posix-iso','posix-locale']);\nif (timeStyle !== undefined && !TIME_STYLES.has(timeStyle) && !timeStyle.startsWith('+')) {\n  throw new RangeError(`invalid --time-style '${timeStyle}'`);\n}","typeGuard":"const isTimeStyle = (v: string): boolean =>\n  /^(posix-)?(full-iso|long-iso|iso|locale)$/.test(v) || v.startsWith('+');","tryCatchPattern":"try {\n  runLs(['--time-style=' + style, ...rest]);\n} catch (e) {\n  if (String(e).includes('invalid --time-style')) {\n    runLs(['--time-style=long-iso', ...rest]); // safe default\n  } else throw e;\n}","preventionTips":["Keep TIME_STYLE values in the GNU keyword set, not BSD ls keywords","Always prefix custom formats with +","Test ls flags after shell profile changes","Centralize ls option building in one helper with validated constants"],"tags":["cli","argument-validation","ls","date-format"],"backgroundTag":"invalid-cli-argument","analyzedSha":"969062200754ea02cfac922e5ebb8c608c079e15","analyzedAt":"2026-08-31T10:29:35.737Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}