apache/seatunnel · error · JobDefineCheckException

Source And Sink can not be null

Error message

Source And Sink can not be null

What it means

checkGraph validates that a job config has at least one source and one sink before building the DAG. If either the sources or sinks list is empty, a JobDefineCheckException with 'Source And Sink can not be null' is thrown. A SeaTunnel job is a data pipeline and must have both endpoints.

Source

Thrown at seatunnel-engine/seatunnel-engine-core/src/main/java/org/apache/seatunnel/engine/core/parse/ConfigParserUtil.java:70

            ReadonlyConfig readonlyConfig,
            ClassLoader classLoader,
            Class<T> factoryClass,
            String factoryId) {
        Set<URL> factoryUrls = new HashSet<>();
        URL factoryUrl =
                FactoryUtil.getFactoryUrl(
                        FactoryUtil.discoverFactory(classLoader, factoryClass, factoryId));
        factoryUrls.add(factoryUrl);
        return factoryUrls;
    }

    public static void checkGraph(
            List<? extends Config> sources,
            List<? extends Config> transforms,
            List<? extends Config> sinks) {
        log.debug("Check whether this config file can generate DAG:");
        if (CollectionUtils.isEmpty(sources) || CollectionUtils.isEmpty(sinks)) {
            throw new JobDefineCheckException("Source And Sink can not be null");
        }
        if (isSimpleGraph(sources, transforms, sinks)) {
            checkSimpleGraph(sources, transforms, sinks);
            return;
        }
        checkComplexGraph(sources, transforms, sinks);
    }

    private static boolean isSimpleGraph(
            List<? extends Config> sources,
            List<? extends Config> transforms,
            List<? extends Config> sinks) {
        return sources.size() == 1
                && sinks.size() == 1
                && (CollectionUtils.isEmpty(transforms) || transforms.size() == 1);
    }

    private static void checkSimpleGraph(

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Add a source block with at least one source plugin to the job config
  2. Add a sink block with at least one sink plugin to the job config
  3. Check HOCON/YAML indentation so source/sink blocks are actually parsed
  4. Validate the config with a minimal working example (e.g. FakeSource + Console sink) to isolate the issue

Example fix

// before
env { parallelism = 1 }
transform { Sql { source_table_name = "t" } }
// after
env { parallelism = 1 }
source {
  FakeSource { result_table_name = "t" }
}
sink {
  Console {}
}
Defensive patterns

Strategy: validation

Validate before calling

if (sources == null || sources.isEmpty() || sinks == null || sinks.isEmpty()) {
    throw new IllegalArgumentException("Job config must define at least one source and one sink");
}

Try / catch

try {
    ConfigParserUtil.checkGraph(sources, transforms, sinks);
} catch (JobDefineCheckException e) {
    log.error("Invalid job definition: {}", e.getMessage());
    throw e;
}

Prevention

When it happens

Trigger: Submitting a HOCON job config whose env block has source or sink plugin list empty/missing; passing empty lists programmatically to checkGraph; a config where all 'source'/'sink' blocks are commented out or malformed so the parser yields an empty list.

Common situations: Job config missing the 'source { }' or 'sink { }' block entirely; YAML/HOCON indentation error hiding plugin blocks; generating configs from templates that leave placeholder sections empty.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/81021ff3d72f6237. Report an issue: GitHub.