{"record":{"id":"42b69522253d1417","repo":"apache/cassandra","slug":"invalid-boolean-styles-s","errorCode":null,"errorMessage":"Invalid boolean styles %s","messagePattern":"Invalid boolean styles (.+?)","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"pylib/cqlshlib/copyutil.py","lineNumber":400,"sourceCode":"        # responds: here we set it to 1 sec per 10 rows but no less than 60 seconds\n        copy_options['requesttimeout'] = int(opts.pop('requesttimeout', max(60, 1 * copy_options['maxbatchsize'] / 10)))\n        # set childtimeout higher than requesttimeout so that child processes have a chance to report request timeouts\n        copy_options['childtimeout'] = int(opts.pop('childtimeout', copy_options['requesttimeout'] + 30))\n\n        self.check_options(copy_options)\n        return CopyOptions(copy=copy_options, dialect=dialect_options, unrecognized=opts)\n\n    @staticmethod\n    def check_options(copy_options):\n        \"\"\"\n        Check any options that require a sanity check beyond a simple type conversion and if required\n        raise a value error:\n\n        - boolean styles must be exactly 2, they must be different and they cannot be empty\n        \"\"\"\n        bool_styles = copy_options['boolstyle']\n        if len(bool_styles) != 2 or bool_styles[0] == bool_styles[1] or not bool_styles[0] or not bool_styles[1]:\n            raise ValueError(\"Invalid boolean styles %s\" % copy_options['boolstyle'])\n\n    @staticmethod\n    def get_num_processes(cap):\n        \"\"\"\n        Pick a reasonable number of child processes. We need to leave at\n        least one core for the parent or feeder process.\n        \"\"\"\n        return max(1, min(cap, CopyTask.get_num_cores() - 1))\n\n    @staticmethod\n    def get_num_cores():\n        \"\"\"\n        Return the number of cores if available. If the test environment variable\n        is set, then return the number carried by this variable. This is to test single-core\n        machine more easily.\n        \"\"\"\n        try:\n            num_cores_for_testing = os.environ.get('CQLSH_COPY_TEST_NUM_CORES', '')","sourceCodeStart":382,"sourceCodeEnd":418,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/pylib/cqlshlib/copyutil.py#L382-L418","documentation":"COPY options validation in cqlsh's CopyHelper rejects a BOOLSTYLE option that is not exactly two distinct, non-empty tokens. The boolstyle option defines the strings used for true/false when exporting or importing CSV data, so both markers must be present and different to disambiguate values.","triggerScenarios":"Running COPY TO/COPY FROM with `BOOLSTYLE='true,false'` variants that fail validation: only one style given, both styles identical (e.g. 'yes,yes'), an empty style (e.g. 'true,'), or an otherwise malformed value that does not split into 2 items.","commonSituations":"Users typo the option as BOOLSTYLE=truefalse, quote it incorrectly so it parses as a single token, copy an example with 't,f' but drop a comma, or set it via a cqlshrc/config file with an empty half.","solutions":["Provide exactly two distinct non-empty styles, e.g. BOOLSTYLE='True,False'","Remove the BOOLSTYLE option to use the default (true/false)","Check quoting so the two styles are parsed as two separate tokens, not one string"],"exampleFix":"// before\nCOPY t (a,b) TO 'out.csv' WITH BOOLSTYLE='true';\n// after\nCOPY t (a,b) TO 'out.csv' WITH BOOLSTYLE='true,false';","handlingStrategy":"validation","validationCode":"styles = options.get('boolstyle', 'true,false').split(',')\nassert len(styles) == 2 and styles[0] and styles[1] and styles[0] != styles[1], \"BOOLSTYLE needs two distinct non-empty styles\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass BOOLSTYLE as two comma-separated distinct tokens","Prefer omitting BOOLSTYLE to use the default true/false","Test COPY options on a small table first"],"tags":["cqlsh","copy","configuration","validation"],"backgroundTag":"invalid-config-value","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}