{"record":{"id":"95a4b89fa7fa823a","repo":"XTLS/Xray-core","slug":"invalid-size","errorCode":null,"errorMessage":"invalid size","messagePattern":"invalid size","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"common/units/bytesize.go","lineNumber":11,"sourceCode":"package units\n\nimport (\n\t\"errors\"\n\t\"strconv\"\n\t\"strings\"\n\t\"unicode\"\n)\n\nvar (\n\terrInvalidSize = errors.New(\"invalid size\")\n\terrInvalidUnit = errors.New(\"invalid or unsupported unit\")\n)\n\n// ByteSize is the size of bytes\ntype ByteSize uint64\n\nconst (\n\t_ = iota\n\t// KB = 1KB\n\tKB ByteSize = 1 << (10 * iota)\n\t// MB = 1MB\n\tMB\n\t// GB = 1GB\n\tGB\n\t// TB = 1TB\n\tTB\n\t// PB = 1PB\n\tPB","sourceCodeStart":1,"sourceCodeEnd":29,"githubUrl":"https://github.com/XTLS/Xray-core/blob/7d214f8b094f75322fa3990f8aadad1c912f24f5/common/units/bytesize.go#L1-L29","documentation":"Sentinel error returned by ByteSize parsing when the numeric part of the size string cannot be parsed as a positive float (strconv error or value <= 0). The input string's byte-count component is at fault, not the unit (which has its own errInvalidUnit sentinel).","triggerScenarios":"Thrown at common/units/bytesize.go:11 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a positive numeric value, e.g. '1024', '1.5MB'","Check for stray characters in the number"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"7d214f8b094f75322fa3990f8aadad1c912f24f5","analyzedAt":"2026-08-15T14:26:24.325Z","contentChangedAt":"2026-08-15T14:26:24.325Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}