Skip to content

lint accepts YAML merge keys (<<) but config init ignores them — config lints clean, fails to start #872

Description

@mkaay

bento lint accepts a config that uses YAML merge keys (<<: *anchor), but at startup the merge is not applied — the merged-in fields are silently dropped, and init fails with a field '…' is required error for a field that was present via the merge. The result is a config that passes lint (e.g. in CI) but fails to boot on deploy.

Minimal repro (no external services needed)

input:
  generate: { count: 1, interval: "", mapping: 'root.id = "x"' }
output:
  broker:
    outputs:
      - sql_raw: &base
          driver: postgres
          dsn: "postgres://localhost/x"
          query: "SELECT 1"
      - sql_raw:
          <<: *base          # merge key — intended to inherit driver/dsn
          query: "SELECT 2"
$ bento lint mergebug.yaml      # exit 0, no errors
$ bento -c mergebug.yaml
... Service closing due to: output 1: failed to init output <no label> path root.output.broker.outputs.1: field 'driver' is required and was not present in the config

Expected

Either merge keys are honored at init (the 2nd output inherits driver/dsn), or lint rejects/warns on << merge keys so the failure surfaces at lint time rather than on deploy.

Actual

lint passes; init drops the merged fields and fails with a misleading "field is required" error pointing at a field that was supplied via the merge.

Version

1.18.0

Likely cause

go-yaml v3 dropped YAML-1.1 merge-key (<<) support. The lint path and the config-init path appear to diverge in how they handle the (unresolved) << key.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions