{"record":{"id":"fa3544b9f217ace1","repo":"sqlmapproject/sqlmap","slug":"switch-api-requires-usage-of-option-c","errorCode":null,"errorMessage":"switch '--api' requires usage of option '-c'","messagePattern":"switch '--api' requires usage of option '-c'","errorType":"exception","errorClass":"SqlmapSyntaxException","httpStatus":null,"severity":"error","filePath":"lib/core/option.py","lineNumber":2871,"sourceCode":"        errMsg += \"OS commands via configuration files or copy-paste attacks, \"\n        errMsg += \"the '--alert' option requires the environment variable \"\n        errMsg += \"'SQLMAP_UNSAFE_ALERT=1' to be explicitly set\"\n        raise SqlmapSystemException(errMsg)\n\n    if conf.evalCode and os.environ.get(\"SQLMAP_UNSAFE_EVAL\") != '1':\n        errMsg = \"for security reasons, to prevent execution of potentially malicious \"\n        errMsg += \"Python code via configuration files or copy-paste attacks, \"\n        errMsg += \"the '--eval' option requires the environment variable \"\n        errMsg += \"'SQLMAP_UNSAFE_EVAL=1' to be explicitly set\"\n        raise SqlmapSystemException(errMsg)\n\n    if conf.chunked and not any((conf.data, conf.requestFile, conf.forms, conf.openApiFile)):\n        errMsg = \"switch '--chunked' requires usage of (POST) options/switches '--data', '-r', '--forms' or '--openapi'\"\n        raise SqlmapSyntaxException(errMsg)\n\n    if conf.api and not conf.configFile:\n        errMsg = \"switch '--api' requires usage of option '-c'\"\n        raise SqlmapSyntaxException(errMsg)\n\n    if conf.data and conf.nullConnection:\n        errMsg = \"option '--data' is incompatible with switch '--null-connection'\"\n        raise SqlmapSyntaxException(errMsg)\n\n    if conf.string and conf.nullConnection:\n        errMsg = \"option '--string' is incompatible with switch '--null-connection'\"\n        raise SqlmapSyntaxException(errMsg)\n\n    if conf.notString and conf.nullConnection:\n        errMsg = \"option '--not-string' is incompatible with switch '--null-connection'\"\n        raise SqlmapSyntaxException(errMsg)\n\n    if conf.tor and conf.osPwn:\n        errMsg = \"option '--tor' is incompatible with switch '--os-pwn'\"\n        raise SqlmapSyntaxException(errMsg)\n\n    if conf.noCast and conf.hexConvert:","sourceCodeStart":2853,"sourceCodeEnd":2889,"githubUrl":"https://github.com/sqlmapproject/sqlmap/blob/0a35b20e3953d341be6c7ac75ccb0b3362540c8d/lib/core/option.py#L2853-L2889","documentation":"Startup option-dependency guard in _basicOptionValidation: the REST API mode (--api, conf.api) is configured through a configuration file, so it fires when conf.api is set but conf.configFile (-c) is missing. Without -c the API server has no saved settings to serve from.","triggerScenarios":"Thrown at lib/core/option.py:2871 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a configuration file with -c (e.g. sqlmap --api -c task.conf)","Remove --api and run sqlmap in normal CLI mode","Write the intended options into a config file first (sqlmap --save) and rerun with -c"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0a35b20e3953d341be6c7ac75ccb0b3362540c8d","analyzedAt":"2026-08-26T23:02:52.002Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}