apache/beam · error · RuntimeException

please provide a parameters function

Error message

please provide a parameters function

What it means

Neo4jIO's write/read spec requires a parameters function mapping each element to Cypher statement parameters. When driverProviderFn or the parameters function is missing at expansion/validation time, this RuntimeException guard fires — without it Neo4jIO cannot bind statement values, so configuration is incomplete and rejected before execution.

Solutions

  1. Add .withParametersFunction(element -> paramMap) matching the Cypher $params.
  2. Use identity mapping if elements already are maps.
  3. Validate required builder fields before expand in a helper.

Example fix

// before
writeUnwindBuilder.expand(p) // missing parameters fn
// after
writeUnwindBuilder.withParametersFunction(row -> Collections.singletonMap("name", row.get("name"))).expand(p)
Defensive patterns

Strategy: validation

Validate before calling

if (writeSpec.getParametersFunction() == null) throw new IllegalStateException("Call .withParametersFunction() before expand()");

Prevention

When it happens

Trigger: Expanding writeUnwind without .withParametersFunction(...); it is mandatory for writes (reads default to an empty map).

Common situations: Reusing read-builder code for writes; refactors dropping the call; forgetting per-row parameter mapping.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of apache/beam@12126d8942 (2026-09-13). Data as JSON: /api/errors/f3068521a490c98a. Report an issue: GitHub.

Appendix: source

Thrown at sdks/java/io/neo4j/src/main/java/org/apache/beam/sdk/io/neo4j/Neo4jIO.java:1033

      checkArgument(cypher != null, "please provide an unwind cypher statement to execute");
      final String unwindMapName = getProvidedValue(getUnwindMapName());
      checkArgument(unwindMapName != null, "please provide an unwind map name");

      Long batchSize = getProvidedValue(getBatchSize());
      if (batchSize == null || batchSize <= 0) {
        batchSize = 5000L;
      }

      Boolean logCypher = getProvidedValue(getLogCypher());
      if (logCypher == null) {
        logCypher = Boolean.FALSE;
      }

      if (driverProviderFn == null) {
        throw new RuntimeException("please provide a driver provider");
      }
      if (parametersFunction == null) {
        throw new RuntimeException("please provide a parameters function");
      }
      WriteUnwindFn<ParameterT> writeFn =
          new WriteUnwindFn<>(
              driverProviderFn,
              sessionConfig,
              transactionConfig,
              cypher,
              parametersFunction,
              batchSize,
              logCypher,
              unwindMapName);

      input.apply(ParDo.of(writeFn));

      return PDone.in(input.getPipeline());
    }

    @Override

View on GitHub (pinned to 12126d8942)