{"record":{"id":"ac8f662d9504fc6c","repo":"ytdl-org/youtube-dl","slug":"invalid-integer-value-r-in-filter-part-r","errorCode":null,"errorMessage":"Invalid integer value %r in filter part %r","messagePattern":"Invalid integer value %r in filter part %r","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"youtube_dl/utils.py","lineNumber":4912,"sourceCode":"            # https://github.com/ytdl-org/youtube-dl/issues/11082).\n            or actual_value is not None and m.group('intval') is not None\n                and isinstance(actual_value, compat_str)):\n            if m.group('op') not in ('=', '!='):\n                raise ValueError(\n                    'Operator %s does not support string values!' % m.group('op'))\n            comparison_value = m.group('quotedstrval') or m.group('strval') or m.group('intval')\n            quote = m.group('quote')\n            if quote is not None:\n                comparison_value = comparison_value.replace(r'\\%s' % quote, quote)\n        else:\n            try:\n                comparison_value = int(m.group('intval'))\n            except ValueError:\n                comparison_value = parse_filesize(m.group('intval'))\n                if comparison_value is None:\n                    comparison_value = parse_filesize(m.group('intval') + 'B')\n                if comparison_value is None:\n                    raise ValueError(\n                        'Invalid integer value %r in filter part %r' % (\n                            m.group('intval'), filter_part))\n        if actual_value is None:\n            return m.group('none_inclusive')\n        return op(actual_value, comparison_value)\n\n    UNARY_OPERATORS = {\n        '': lambda v: (v is True) if isinstance(v, bool) else (v is not None),\n        '!': lambda v: (v is False) if isinstance(v, bool) else (v is None),\n    }\n    operator_rex = re.compile(r'''(?x)\\s*\n        (?P<op>%s)\\s*(?P<key>[a-z_]+)\n        \\s*$\n        ''' % '|'.join(map(re.escape, UNARY_OPERATORS.keys())))\n    m = operator_rex.search(filter_part)\n    if m:\n        op = UNARY_OPERATORS[m.group('op')]\n        actual_value = dct.get(m.group('key'))","sourceCodeStart":4894,"sourceCodeEnd":4930,"githubUrl":"https://github.com/ytdl-org/youtube-dl/blob/956b8c585591b401a543e409accb163eeaaa1193/youtube_dl/utils.py#L4894-L4930","documentation":"Raised by _match_one() in youtube_dl.utils while evaluating a --match-filter expression. The comparison value was parsed as a number but int() failed and parse_filesize() could not interpret it either as-is (e.g. '100K') or with a 'B' suffix appended (e.g. '100KB'). The filter part therefore contains something in the numeric slot that is neither an integer, a bare size multiplier, nor a valid filesize string.","triggerScenarios":"Running --match-filter with a malformed comparison such as filesize>10x, duration>1.5 (floats are not supported), filesize<1oKB, or any field>token where token is not an integer or a recognized filesize unit (K/M/G with optional B). parse_filesize accepts forms like '100K'/'100MB' via the implicit +'B' retry.","commonSituations":"Typos in match-filter expressions; assuming float or decimal values are supported (only ints and file sizes are); using unusual unit suffixes parse_filesize does not recognize; missing spaces or stray characters after the number.","solutions":["Use plain integers for numeric fields: --match-filter \"view_count>=1000\".","For filesize use recognized units: --match-filter \"filesize<50M\" (K, M, G, optionally with B).","Remove stray characters/typos after the number in the filter part.","If you need float comparisons (e.g. average_rating>4.5), filter in a wrapper script with --dump-json instead of the filter DSL."],"exampleFix":"# before\nyoutube-dl --match-filter \"filesize<50MBs\" URL   # ValueError: Invalid integer value '50MBs' in filter part 'filesize<50MBs'\nyoutube-dl --match-filter \"average_rating>4.5\" URL  # floats rejected\n\n# after\nyoutube-dl --match-filter \"filesize<50M\" URL","handlingStrategy":"validation","validationCode":"import re\nfrom youtube_dl.utils import parse_filesize\n\ndef valid_numeric_part(part):\n    m = re.match(r'^[a-z_]+\\s*(=|!=|<|<=|>|>=|~=)\\s*(.+)$', part)\n    if not m:\n        return False\n    v = m.group(2)\n    if m.group(1) not in ('=', '!='):\n        return v.isdigit() or (parse_filesize(v) is not None) or (parse_filesize(v + 'B') is not None)\n    return True","typeGuard":"def is_supported_filter_value(value: str) -> bool:\n    return value.isdigit() or parse_filesize(value) is not None or parse_filesize(value + 'B') is not None","tryCatchPattern":"from youtube_dl.utils import match_str\ntry:\n    match_str('filesize<50X', info)\nexcept ValueError as e:\n    # tell the user which part is malformed and abort before downloading\n    raise SystemExit('bad --match-filter: %s' % e)","preventionTips":["Use plain integers or K/M/G filesize units in filters.","No floats or decimals in the filter DSL; pre-filter with --dump-json + jq/script instead.","Run --simulate once with a new filter to catch syntax errors before real downloads."],"tags":["match-filter","cli","validation","user-input"],"backgroundTag":null,"analyzedSha":"956b8c585591b401a543e409accb163eeaaa1193","analyzedAt":"2026-08-14T18:59:47.863Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}