{"record":{"id":"b0f593413d5aaf19","repo":"hcengineering/platform","slug":"invalid-numeric-value","errorCode":null,"errorMessage":"Invalid numeric value","messagePattern":"Invalid numeric value","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/card-resources/src/components/navigator-next/NavigatorCardsSection.svelte","lineNumber":58,"sourceCode":"  let contextByCard = new Map<Ref<Card>, NotificationContext>()\n  let isLoading: boolean = true\n  let hasMore = false\n\n  let sort: 'alphabetical' | 'recent' | undefined\n  $: sort = config.specialSorting?.[type._id] ?? config.defaultSorting ?? 'alphabetical'\n\n  let limit = config.limit\n\n  $: ids = (config.labelFilter?.length ?? 0) > 0 ? labels.map((it) => it.cardId) : undefined\n\n  function parseLookbackDuration (input: string): Timestamp {\n    if (input.length < 2) throw new Error('Invalid duration format')\n\n    const unit = input.slice(-1)\n    const numberPart = input.slice(0, -1)\n    const value = Number(numberPart)\n\n    if (isNaN(value) || value <= 0) throw new Error('Invalid numeric value')\n\n    const multipliers: Record<string, number> = {\n      m: 60 * 1000,\n      h: 60 * 60 * 1000,\n      d: 24 * 60 * 60 * 1000,\n      w: 7 * 24 * 60 * 60 * 1000\n    }\n\n    const multiplier = multipliers[unit]\n\n    if (!multiplier) throw new Error(`Unsupported time unit: ${unit}`)\n\n    return value * multiplier\n  }\n\n  $: cardIds = ids?.filter((it) => !favorites.some((fav) => fav.attachedTo === it))\n\n  $: if ((cardIds && cardIds.length > 0) || (config.labelFilter?.length ?? 0) === 0) {","sourceCodeStart":40,"sourceCodeEnd":76,"githubUrl":"https://github.com/hcengineering/platform/blob/63e28dc96483967b2fc21c881b3f1023c1de7718/plugins/card-resources/src/components/navigator-next/NavigatorCardsSection.svelte#L40-L76","documentation":"parseLookbackDuration converts the numeric prefix of the duration string with Number() and rejects it when the result is NaN or <= 0. This throws 'Invalid numeric value', meaning the string had a unit but the number part was not a positive number.","triggerScenarios":"Passing values like \"xd\", \"7.5.5h\", \"-3d\", \".d\", or \"  d\" where `Number(numberPart)` yields NaN or a non-positive value.","commonSituations":"Hand-edited config files, copy/paste errors introducing stray characters, accidental negative values, or non-Latin digits pasted from other tools.","solutions":["Correct the config to a positive integer with a supported unit, e.g. \"14d\".","Trim the input and validate with a regex like /^\\d+[mhdw]$/ before parsing.","Constrain the settings UI to a numeric input followed by a unit selector."],"exampleFix":"// before\nlookback = '-3d'\n// after\nlookback = '3d'","handlingStrategy":"validation","validationCode":"const numberPart = input.slice(0, -1)\nconst value = Number(numberPart)\nif (isNaN(value) || value <= 0) { ui.notify('Duration number must be a positive number, e.g. 7d'); return }","typeGuard":"function isPositiveNumber(v: string): boolean { const n = Number(v); return !isNaN(n) && n > 0 }","tryCatchPattern":"try {\n  const ts = parseLookbackDuration(input)\n} catch (e) {\n  if (e instanceof Error && e.message === 'Invalid numeric value') {\n    input = '7d'\n  } else throw e\n}","preventionTips":["Trim and normalize input before parsing to avoid stray whitespace/characters.","Constrain settings UI to numeric input fields for the duration value.","Reject non-ASCII digits and negative values at input time."],"tags":["validation","parsing","configuration"],"backgroundTag":"invalid-duration-format","analyzedSha":"63e28dc96483967b2fc21c881b3f1023c1de7718","analyzedAt":"2026-08-29T15:21:27.377Z","schemaVersion":2},"datasetVersion":"2026-08-29T17:17:51.833Z"}