{"record":{"id":"b6f7fb973d5f22d7","repo":"windmill-labs/windmill","slug":"invalid-s3-mode-format","errorCode":null,"errorMessage":"Invalid S3 mode format: {}","messagePattern":"Invalid S3 mode format: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/parsers/windmill-parser-sql/src/lib.rs","lineNumber":188,"sourceCode":"    let mut prefix = None;\n    let mut storage = None;\n    let mut format = S3ModeFormat::Json;\n\n    for kv in args_str.split(' ').map(|kv| kv.trim()) {\n        if kv.is_empty() {\n            continue;\n        }\n        let mut it = kv.split('=');\n        let (Some(key), Some(value)) = (it.next(), it.next()) else {\n            return Err(anyhow!(\"Invalid S3 mode argument: {}\", kv));\n        };\n        match (key.trim(), value.trim()) {\n            (\"prefix\", _) => prefix = Some(value.to_string()),\n            (\"storage\", _) => storage = Some(value.to_string()),\n            (\"format\", \"json\") => format = S3ModeFormat::Json,\n            (\"format\", \"parquet\") => format = S3ModeFormat::Parquet,\n            (\"format\", \"csv\") => format = S3ModeFormat::Csv,\n            (\"format\", format) => return Err(anyhow!(\"Invalid S3 mode format: {}\", format)),\n            (_, _) => return Err(anyhow!(\"Invalid S3 mode argument: {}\", kv)),\n        }\n    }\n\n    Ok(Some(S3ModeArgs { prefix, storage, format }))\n}\n\npub fn parse_sql_blocks(code: &str, track_dollar_quotes: bool) -> Vec<&str> {\n    let mut blocks = vec![];\n    let mut last_idx = 0;\n\n    run_on_sql_statement_matches(\n        code,\n        track_dollar_quotes,\n        |char, _| char == ';',\n        |idx, _| {\n            blocks.push(&code[last_idx..=idx]);\n            last_idx = idx + 1;","sourceCodeStart":170,"sourceCodeEnd":206,"githubUrl":"https://github.com/windmill-labs/windmill/blob/e474e8803ce2ff5c2df09a58dab51d45f5c922ca/backend/parsers/windmill-parser-sql/src/lib.rs#L170-L206","documentation":"windmill-parser-sql parses S3 mode options passed to SQL scripts (e.g. `s3://...?prefix=x&storage=y&format=csv` style key-value pairs). parse_s3_mode accepts only format values json, parquet, or csv; any other format value makes the parser fail fast with this message so the invalid S3 config never reaches job execution.","triggerScenarios":"Calling any SQL parse entrypoint (do_bigquery, do_mssql, do_mysql, do_oracledb, do_postgresql, do_snowflake) with an S3 mode argument whose `format` key has a value outside {json, parquet, csv}, e.g. `format=avro` or `format=JSON` (case-sensitive).","commonSituations":"Typos in format names, uppercase/lowercase mismatch, copying configs from other tools that support more formats (avro, orc), or hand-editing a script's S3 settings in the UI YAML.","solutions":["Change the format value to one of json, parquet, or csv","Check for case mismatches — the match is lowercase-exact","If you need another format, it is unsupported by the parser; use one of the three supported ones"],"exampleFix":"// before\ns3mode=prefix=/data,storage=s3,format=avro\n// after\ns3mode=prefix=/data,storage=s3,format=parquet","handlingStrategy":"validation","validationCode":"const SUPPORTED = new Set(['json', 'parquet', 'csv']);\nfunction validateS3ModeFormat(format) {\n  if (!SUPPORTED.has(format)) throw new Error(`Invalid S3 mode format: ${format}. Use json, parquet, or csv.`);\n}\nvalidateS3ModeFormat('parquet'); // call before deploy/parse","typeGuard":"function isS3ModeFormat(v) { return v === 'json' || v === 'parquet' || v === 'csv'; }","tryCatchPattern":"try {\n  parseSqlWithS3Mode(script);\n} catch (e) {\n  if (String(e).includes('Invalid S3 mode format')) {\n    // surface a config-validation message to the user\n  } else throw e;\n}","preventionTips":["Keep format values lowercase and in {json,parquet,csv}","Validate S3 mode strings in the editor before deploying","Copy configs only from documented examples"],"tags":["s3","sql-parser","configuration","validation"],"backgroundTag":"invalid-s3-mode-format","analyzedSha":"e474e8803ce2ff5c2df09a58dab51d45f5c922ca","analyzedAt":"2026-09-03T12:38:19.024Z","contentChangedAt":"2026-09-03T12:38:19.024Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}