{"record":{"id":"1a7e7348200268a4","repo":"D4Vinci/Scrapling","slug":"unknown-unsupported-curl-arguments-unknown","errorCode":null,"errorMessage":"Unknown/Unsupported curl arguments: {unknown}","messagePattern":"Unknown/Unsupported curl arguments: (.+?)","errorType":"exception","errorClass":"AttributeError","httpStatus":null,"severity":"error","filePath":"scrapling/core/shell.py","lineNumber":164,"sourceCode":"        self.parser: NoExitArgumentParser = _parser\n        self._supported_methods = (\"get\", \"post\", \"put\", \"delete\")\n\n    # --- Main Parsing Logic ---\n    def parse(self, curl_command: str) -> Optional[Request]:\n        \"\"\"Parses the curl command string into a structured context for Fetcher.\"\"\"\n\n        clean_command = curl_command.strip().lstrip(\"curl\").strip().replace(\"\\\\\\n\", \" \")\n\n        try:\n            tokens = shlex_split(clean_command)  # Split the string using shell-like syntax\n        except ValueError as e:  # pragma: no cover\n            log.error(f\"Could not split command line: {e}\")\n            return None\n\n        try:\n            parsed_args, unknown = self.parser.parse_known_args(tokens)\n            if unknown:\n                raise AttributeError(f\"Unknown/Unsupported curl arguments: {unknown}\")\n\n        except ValueError:  # pragma: no cover\n            return None\n\n        except AttributeError:\n            raise\n\n        except Exception as e:  # pragma: no cover\n            log.error(f\"An unexpected error occurred during curl arguments parsing: {e}\")\n            return None\n\n        # --- Determine Method ---\n        method = \"get\"  # Default\n        if parsed_args.get:  # `-G` forces GET\n            method = \"get\"\n\n        elif parsed_args.method:\n            method = parsed_args.method.strip().lower()","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/D4Vinci/Scrapling/blob/5d213a2d4764002bfc4fed33c32fe09fa8b0bf7f/scrapling/core/shell.py#L146-L182","documentation":"After parse_known_args, any leftover tokens are flags Scrapling's curl parser does not map. Instead of silently ignoring them (which would change request semantics), it raises AttributeError('Unknown/Unsupported curl arguments: ...') listing the unknown tokens. The surrounding except block deliberately re-raises AttributeError while converting other parser failures to None.","triggerScenarios":"A DevTools-copied curl containing newer or uncommon flags outside the mapped set — e.g. --http2-only, --tlsv1.3, -w '%{...}', --no-keepalive, or a typo'd flag like --cmpressed. Anything unrecognized in the token stream lands in `unknown` and triggers this.","commonSituations":"Chrome DevTools progressively adding flags to 'Copy as cURL' output across versions, curl commands from other tools (insomnia/postman exports) with extra options, or manually added tuning flags.","solutions":["Read the listed unknown tokens and delete those flags (and their values) from the command before retrying","Keep the flags that matter semantically (method, headers, data, cookies, auth, proxy) and drop transport tuning flags","If the flag is essential (e.g. an auth header), translate it manually into the equivalent Fetcher kwarg instead of the curl string"],"exampleFix":"# before\nshell.from_curl(\"curl 'https://example.com' --http2-only -H 'Accept: text/html'\")\n# AttributeError: Unknown/Unsupported curl arguments: ['--http2-only']\n\n# after\nshell.from_curl(\"curl 'https://example.com' -H 'Accept: text/html'\")","handlingStrategy":"validation","validationCode":"import shlex\n\nSUPPORTED = {'-X', '--request', '-H', '--header', '-d', '--data', '--data-raw', '-b', '--cookie', '-u', '--user', '-x', '--proxy', '-A', '--user-agent', '-e', '--referer', '-G', '--get', '--compressed', '-k', '--insecure', '-L', '--location', '-I', '--head', '--data-binary', '--data-urlencode'}\n\ntokens = shlex.split(curl_cmd.lstrip('curl').strip())\ntokens = [t for t in tokens if not t.startswith('-') or t in SUPPORTED]\ncurl_cmd = 'curl ' + ' '.join(tokens)","typeGuard":null,"tryCatchPattern":"try:\n    req = shell.parse_curl(curl_cmd)\nexcept AttributeError as e:\n    unknown = eval(str(e).split(': ')[-1])  # tokens listed in the message\n    drop = set(unknown) | {t for t in unknown if not t.startswith('-')}\n    tokens = [t for t in shlex.split(curl_cmd) if t not in drop]\n    req = shell.parse_curl('curl ' + ' '.join(tokens))","preventionTips":["Keep only semantic flags (method, headers, data, cookies, auth, proxy) when trimming DevTools curl output","Catch AttributeError specifically if you pre-filter unknown flags programmatically"],"tags":["shell","curl","parsing","unsupported-flags"],"backgroundTag":null,"analyzedSha":"5d213a2d4764002bfc4fed33c32fe09fa8b0bf7f","analyzedAt":"2026-08-14T22:23:09.440Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}