{"record":{"id":"fe50f1102dc0d922","repo":"apache/seatunnel","slug":"missing-necessary-field","errorCode":"MISSING_NECESSARY_FIELD","errorMessage":"'schema' is required.","messagePattern":"'schema' is required\\.","errorType":"error_code","errorClass":"SensorsDataException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-sensorsdata/src/main/java/org/apache/seatunnel/connectors/sensorsdata/format/record/RowAccessor.java","lineNumber":313,"sourceCode":"\n        // Set $time\n        if (this.eventTimeUseCurrentTime) {\n            properties.put(SensorsConst.TIME_SYSTEM_ATTR, new Date());\n        } else {\n            if (this.timeColumnIndex != null) {\n                properties.put(\n                        SensorsConst.TIME_SYSTEM_ATTR,\n                        TypeUtil.toTargetType(\n                                row.getField(this.timeColumnIndex),\n                                SensorsDataTypes.DataTypes.DATE));\n            }\n        }\n        return properties;\n    }\n\n    public String getSchemaRequired() {\n        if (StringUtils.isBlank(schema)) {\n            throw new SensorsDataException(\n                    SensorsDataErrorCode.MISSING_NECESSARY_FIELD, \"'schema' is required.\");\n        }\n\n        return schema;\n    }\n\n    public String getDetailIdRequired(SeaTunnelRow row) {\n        String detailId =\n                (String)\n                        TypeUtil.toTargetType(\n                                row.getField(detailIdColumnIndex),\n                                SensorsDataTypes.DataTypes.STRING);\n\n        if (StringUtils.isBlank(detailId)) {\n            throw new SensorsDataException(\n                    SensorsDataErrorCode.MISSING_NECESSARY_FIELD, \"'detailId' is required.\");\n        }\n","sourceCodeStart":295,"sourceCodeEnd":331,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-sensorsdata/src/main/java/org/apache/seatunnel/connectors/sensorsdata/format/record/RowAccessor.java#L295-L331","documentation":"RowAccessor.getSchemaRequired() returns the configured 'schema' option but throws SensorsDataException(MISSING_NECESSARY_FIELD) if it is null or blank. The schema is mandatory for building Sensors Data records (e.g., item/item-set records need the project schema); a blank schema means the sink cannot address the correct dataset.","triggerScenarios":"The sink config omits schema (or sets schema = \"\"), and record building calls getSchemaRequired() — e.g., SpecialItemRecord building for record_type=items.","commonSituations":"Template configs that hardcode schema were copied without editing; schema was renamed to a wrong key so the option defaults to null; environment-specific values left as placeholder/empty strings.","solutions":["Add schema = \"<your_schema>\" to the sink configuration and rerun the job.","Verify the option key spelling is exactly 'schema' and the value is non-blank (no stray whitespace-only value).","Validate the config before submission: fail fast if required options are blank instead of discovering this mid-job.","Check the connector docs for whether your record type requires schema, and set it accordingly."],"exampleFix":"// before\nsink {\n  SensorsData {\n    schema = \"\"\n  }\n}\n// after\nsink {\n  SensorsData {\n    schema = \"default\"\n  }\n}","handlingStrategy":"validation","validationCode":"// pre-flight config check\nif (schema == null || schema.isBlank()) {\n    throw new IllegalArgumentException(\"schema is required for the SensorsData sink\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    String schema = rowAccessor.getSchemaRequired();\n} catch (SensorsDataException e) {\n    if (SensorsDataErrorCode.MISSING_NECESSARY_FIELD.equals(e.getErrorCode())) {\n        log.error(\"Sink misconfigured: {}\", e.getMessage());\n        throw new JobConfigException(\"Set 'schema' in the sink config\", e);\n    }\n    throw e;\n}","preventionTips":["Treat schema as a mandatory sink option; never copy templates with blank placeholders.","Fail fast at config-load time for blank required options.","Environment-specific configs: verify schema after variable substitution.","Re-validate configs after migrating or renaming option keys."],"tags":["sensorsdata","seatunnel","config","schema"],"backgroundTag":"missing-required-config-field","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}