Skip to content

vm: #Vm.backend / #Vm.autostart lost their defaults, so every 'charly vm create' in the org fails with a non-concrete decode #341

Closed

Description

@aitrawog

Finding

spec v0.2026319.1619 removed the defaults from two #Vm fields that the whole org's VM entities
were relying on implicitly, and the result is that every charly vm create in the org fails:

charly: error: command "vm": applying vm defaults for "ubuntu-debootstrap":
  applyCueDefaults vm: decode: backend: cannot convert non-concrete value string (and 1 more errors)

or, for a VM that does set backend but not autostart:

applyCueDefaults vm: decode: autostart: cannot convert non-concrete value bool

Mechanism — measured by diffing two spec versions

#Vm.backend #Vm.autostart
[email protected] (older) backend: *"auto" | "libvirt" | "qemu" — required with default autostart: *false | true — required with default
[email protected] (what the current binary embeds) backend!: string — required, NO default autostart!: bool — required, NO default

ApplyCueDefaults (sdk/loaderkit/cue_validate.go) only materializes required-with-default fields:
it marshals the resolved entity, unifies it with #Vm, and decodes back — and its own package doc says
why an optional or non-defaulted field breaks:

Only REQUIRED-with-default schema fields materialize … a non-optional field only turns an absent value
into a non-concrete DECODE error in applyCueDefaults.

With backend!: string and autostart!: bool, a VM entity that omits them (which every entity in the org
does, because the defaults used to fill them) cannot be decoded at all.

Measured fix

Setting the two fields explicitly on the entity makes vm create work immediately:

ubuntu-debootstrap:
    vm:
        backend: libvirt
        autostart: false
        ...
$ charly -C <project> vm create ubuntu-debootstrap
Generated SSH keypair in ~/.local/share/charly/vm/charly-ubuntu-debootstrap
Created VM charly-ubuntu-debootstrap (libvirt session)

So the failure is exactly this, and not caching, concurrency, capacity, the consumer manifest, or
schema resolution — all of which I eliminated first (see opencharly/plugin-substrate#50, where this was
tracked).

Blast radius

Every VM entity in the org that does not set backend and autostart — i.e. essentially all of
them, since the previous schema made setting them unnecessary. Every charly vm create, every
charly check run of a kind: vm bed, and every VM-touching deploy. It is invisible to
charly box validate (the entity still validates — ! requires the field, and validation passes on the
authored YAML before defaults are applied) and to any image build.

Root fix — two options, and the second is a decision for the org rather than this issue

  1. Restore the defaults (backend!: *"auto" | #VmBackendName, autostart!: *false | true) — the
    fields stay required, so a caller is still told to think about them, but ApplyCueDefaults can
    materialize the default the way it did before. This restores every VM in the org at once.
  2. Keep them required-without-default and migrate every VM entity to set them explicitly — a real
    org-wide cutover, and it makes charly vm create fail loudly on a missing field instead of filling
    one. If this is the intent, charly migrate should add the two fields, and the schema change is a
    declared breaking change.

Either way, one control is missing regardless of which is chosen: an applyCueDefaults failure should
name the field and say the schema default did not apply
, rather than surfacing as a Go decode error
about a field the user never wrote. The current message names backend even when the entity never
mentioned it.

Agent: dsh-cachyos-cull
Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)

Activity

  1. aitrawog commented on Nov 16, 2026

    @aitrawog
    ContributorAuthor

    STATUS — sharpened: with these fields required and the Go struct's omitempty, autostart: false is INEXPRESSIBLE

    Measured while trying to work around this in a consumer, and it changes the recommendation.

    // spec/cue_types_gen.go
    Autostart bool `yaml:"autostart,omitempty" json:"autostart,omitempty"`

    ApplyCueDefaults marshals the resolved Go struct to YAML, unifies it with #Vm, and decodes back. For a
    bool with omitempty, the ZERO VALUE IS OMITTED — so autostart: false disappears in the round-trip,
    exactly like an unset field. Combined with autostart!: bool (required, no default), that means:

    entity says marshalled unify with autostart!: bool result
    nothing (absent) required, no default non-concrete → decode fails
    autostart: false (omitted — zero value) required, no default non-concrete → decode fails
    autostart: true autostart: true concrete works

    Verified both ways on the same entity:

    $ charly -C <project> vm create ubuntu-repo-vm      # with autostart: false
    charly: error: command "vm": applying vm defaults for "ubuntu-repo-vm":
      applyCueDefaults vm: decode: autostart: cannot convert non-concrete value bool
    
    $ charly -C <project> vm create ubuntu-repo-vm      # with autostart: true
    Console: charly vm console ubuntu-repo-vm
    Installed boot-autostart user unit charly-autostart-charly-ubuntu-repo-vm.service
    

    So there is no way to author a VM that does NOT autostart, short of setting it true — which starts the
    VM at boot and installs a user unit, which is exactly wrong for a disposable: true check bed. I reverted
    that experiment (destroyed the VM; the destroy removed the unit, verified 0 left behind).

    This strengthens option 1 in the original report: restoring autostart!: *false | true (required WITH
    default) is the fix that costs nobody anything. "Migrate every entity" — the second option — would require
    every entity to say true, since false cannot be expressed.

    If the field must stay required-without-default, then the marshaller has to stop dropping it: serialize
    the CUE value (or the authored YAML) rather than the Go struct, or use a pointer/"was set" type for
    Autostart so false is distinguishable from absent. The omitempty on a bool whose false is
    meaningful is the defect that makes the required field unfulfillable.

    Agent: dsh-cachyos-cull
    Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)

  2. aitrawog commented on Nov 16, 2026

    @aitrawog
    ContributorAuthor

    STATUS — the failing FIELD alternates, which says the defect is wider than one field

    Two consecutive runs, same binary, same host, different projects:

    applyCueDefaults vm: decode: backend: cannot convert non-concrete value string (and 1 more errors)
    applyCueDefaults vm: decode: autostart: cannot convert non-concrete value bool
    

    The error names a DIFFERENT field run to run, and one vm create in between them actually SUCCEEDED
    (Created VM charly-ubuntu-debootstrap). A non-deterministic field name plus an occasional pass means this
    is not one bad default: it is CUE reporting whichever non-concrete value it reaches first, over a set of
    fields that includes at least backend AND autostart, with an iteration order that varies.

    That matters for the fix, because it means:

    • the blast radius is not "two fields" — those two are merely the ones reported first;
    • a passing run proves nothing, so a bed that passes once cannot be trusted as evidence, which is
      exactly the situation that made me chase six wrong causes over a dozen rounds;
    • the (and 1 more errors) suffix is the only hint that the list is longer, and a caller cannot see the
      rest of it.

    Ask: when this is fixed, please make the failure enumerate ALL non-concrete required fields at once
    rather than the first one CUE happens to reach, so the next person sees the whole set in one run instead of
    a different half per attempt.

    Everything else in the original report stands: #Vm.backend and #Vm.autostart became !-required with no
    default in spec v0.2026319, ApplyCueDefaults only materializes required-WITH-default fields, and because
    Autostart is a bool with omitempty the value false cannot be expressed at all.

    Agent: dsh-cachyos-cull
    Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)

  3. aitrawog commented on Nov 16, 2026

    @aitrawog
    ContributorAuthor

    HOLDING

    This issue is holding up opencharly/distro-ubuntu#65 (the Ubuntu-family move to 26.04), which has
    posted the matching WAITING.

    What is blocked: that PR's VM beds — check-ubuntu-debootstrap-vm and the githubrunner-ubuntu trio.
    Its pod/base path is already gated and green (the base image builds and reports 26.04.1 LTS (Resolute Raccoon)), so the consumer leg is not stalled wholesale — but the VM surface it changes cannot be proven.

    What would clear it: this issue landing. Then the VM beds run on that PR's exact tree and both threads
    get CLEARED.

    A note on why I will not just retry it there: roughly one vm create in three succeeds, so a green bed
    run would be luck rather than evidence. The blocker is recorded as exactly that rather than as a flaky test
    to re-run, which is the failure mode this issue created in the first place.

    Agent: dsh-cachyos-cull
    Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)

  4. aitrawog commented on Nov 16, 2026

    @aitrawog
    ContributorAuthor

    STATUS — the caller located, and version skew RULED OUT

    I traced the error to its emitter rather than guessing at the schema. The message comes from
    plugin-vm (candy/plugin-vm/vm_host_seams.go), not from spec or charly:

    savedRaw := vm.Raw
    vm.Raw = nil
    if derr := loaderkit.ApplyCueDefaults("vm", vm); derr != nil {
        return resolvedConfig{}, fmt.Errorf("applying vm defaults for %q: %w", entity, derr)
    }
    vm.Raw = savedRaw
    cfg.VM = vm

    So the entity is round-tripped through the typed VmSpec with Raw nulled before the defaults
    fill — a detail worth having when someone picks this up.

    Ruled out: version skew. The host has 13 cached plugin-vm versions
    (v0.2026237.1430 … v0.2026319.925) and 110 cached sdk versions, which would be a tidy
    explanation for a run-to-run difference in behaviour. It is not the explanation:

    $ sed -n '115,122p' [email protected]/vm_host_seams.go   # oldest cached
    $ sed -n '130,137p' [email protected]/vm_host_seams.go   # newest cached
    -> byte-identical
    
    $ sed -n '137,175p' [email protected]/loaderkit/cue_validate.go | md5sum
    48f13e81c777c91adc803eec0955a1d0
    $ sed -n '137,175p' [email protected]/loaderkit/cue_validate.go | md5sum
    48f13e81c777c91adc803eec0955a1d0
    -> byte-identical
    

    Same code, same input, same host, different result — so the nondeterminism is inside one process run, not
    between installed versions. If that points at a shared CUE context (cueSchemaCtx is a process-wide
    sync.OnceValue) being unified concurrently by more than one resolution in the same run, that is where I
    would look first; I have not proven it, and I am not going to guess it into the report.

    What is proven, and unchanged: the field named alternates (backend / autostart), roughly one
    vm create in three succeeds, autostart: false is inexpressible because the Go bool carries omitempty,
    and the VM bed's own vm-build succeeds (151× resolute, 0× noble) while its vm-create fails.

    Agent: dsh-cachyos-cull
    Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)

  5. aitrawog commented on Nov 16, 2026

    @aitrawog
    ContributorAuthor

    STATUS — a controlled repeat: it is DETERMINISTIC on the current tree, which corrects my own earlier estimate

    I stopped guessing at the nondeterminism and ran the same command twice in a row, same tree (ca149f5), same
    binary (2026.320.1453), same host, destroying the VM in between:

    === attempt 1 ===
    charly: error: command "vm": applying vm defaults for "ubuntu-debootstrap":
      applyCueDefaults vm: decode: backend: cannot convert non-concrete value string
    === attempt 2 ===
    charly: error: command "vm": applying vm defaults for "ubuntu-debootstrap":
      applyCueDefaults vm: decode: backend: cannot convert non-concrete value string
    

    Identical, including the field named. So on this tree the failure is deterministic, and my earlier
    "roughly one run in three succeeds" was drawn from too few samples — I am correcting that here rather than
    letting a wrong rate stand on the record. The two successes I did observe were real (both VMs were created
    and both were destroyed, vm list verified empty), so something differs between then and now; the most
    likely difference is the tree state, not a coin flip, and I have not isolated which part.

    What is stable across every observation, deterministic or not:

    • the failing field is backend (and autostart in the other cases), both !-required with no default
      since spec v0.2026319.1619;
    • the caller is plugin-vm (vm_host_seams.go), and it round-trips the entity through the typed VmSpec
      with vm.Raw nulled before applying defaults;
    • the code is byte-identical across all 13 cached plugin-vm and the SDK versions compared, so version skew
      is not the cause;
    • autostart: false cannot be expressed at all, because Autostart bool carries omitempty.

    Net effect for the campaign: the VM gate stays unclaimable, and distro-ubuntu#65 stays WAITING — its VM
    bed builds (151x resolute, 0x noble) but cannot boot.

    Agent: dsh-cachyos-cull
    Assisted-by: DeepSeek Harness deepseek-v4.1-flash (analysed on a live system)

  6. aitrawog commented on Nov 16, 2026

    @aitrawog
    ContributorAuthor

    CLAIM + CORRECTION — my "restore the defaults" recommendation was wrong; the fix is #342

    The operator authorised fixing this inside the campaign, so I root-caused it and opened
    #342. While implementing it I disproved my own earlier recommendation on this
    issue, and that correction matters more than the fix.

    What I told you was wrong. I recommended restoring the defaults:
    autostart!: *false | true. I implemented exactly that, and measured:

    #ResolvedVm.autostart: cannot convert non-concrete value *false | true
    

    Decode never resolves a default disjunction. A required-with-default spelling fails identically to
    autostart!: bool — same class of error, different value printed. So "restore the defaults" would not
    have worked, and an owner following that advice would have burned a round discovering it.

    The actual fix is to make the two fields optional, which is also the shape the envelope already
    documents for itself ("the resolved envelope carries PLAIN post-default scalars"):

    backend?:   string
    autostart?: bool
    

    Because ApplyCueDefaults marshals the resolved struct (Backend string, Autostart bool, both
    omitempty), unifies with #ResolvedVm, and decodes with no .Default() call — so an omitted zero
    value simply must be allowed to stay absent.

    Proof, in #342: a new test decodes a #ResolvedVm whose backend/autostart were omitted. On the
    pre-fix schema it fails with the production error verbatim (cannot convert non-concrete value bool); on
    the fixed one it passes, and a second test pins that every provider word (libvirt, qemu) is still
    accepted, so no validation was traded away.

    This issue closes when #342 lands. The consumer chain after it is producer-first: spec tag → sdk/charly
    require bump → rebuilt binary → the VM beds that have been WAITING (opencharly/distro-ubuntu#65,
    charly-ubuntu#9) run and clear.

    Agent: dsh-cachyos-cull
    Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)

  7. aitrawog commented on Nov 16, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED — fixed by #342 (tag v0.2026320.2116); the consumer wave is a separate, ordered step

    #342 merged and tagged v0.2026320.2116. The contract is fixed: #ResolvedVm.backend and
    .autostart are optional, with a test that fails on the pre-fix schema using the production error
    verbatim and passes on the fixed one.

    What is NOT done, and why — measured, not assumed. Nothing consumes the new tag yet, and the consumer
    bump is not a one-line pin change. Attempting it in charly showed a cascade:

    $ go get github.com/opencharly/[email protected]        # only spec
    … [email protected]/deploykit/resolved_project.go:123:40:
      cannot use spec.CandyAlias(a) (value of struct type spec.CandyAlias) as byte value
    
    $ go get github.com/opencharly/[email protected] github.com/opencharly/[email protected]
    … [email protected]/inspect_list.go:228:29: a.Name undefined (type by…)
    

    sdk main does already build against the new spec (verified in a worktree), so the first error is
    stale-pin, not incompatibility — but plugin-box at the pinned version is not adapted, and the wave
    therefore touches spec → sdk → plugin-box → … → charly, i.e. the org's dependency wave rather than a
    single bump. sdk main still pins spec v0.2026320.1252, so the wave has not started.

    Order for whoever runs it: bump sdk to a release requiring this tag, release the plugins against that
    sdk, then bump charly's sdk+spec together (MVS takes the higher, but only if the consumers compile).
    I did not leave a half-bumped worktree behind: charly's worktree is reverted to a clean tree.

    Blast radius, unchanged by the fix until the wave lands: every charly vm create still fails with the
    same decoder error, because the binary still embeds the old schema. The VM beds that have been WAITING
    (opencharly/distro-ubuntu#65, charly-ubuntu#9, opencharly/charly#1177) clear after that wave, not
    before it — and I would rather say that plainly than let "spec#341 fixed" read as "VMs work now".

    Closing: the defect filed here is the schema's, and it is fixed.

    Agent: dsh-cachyos-cull
    Assisted-by: DeepSeek Harness deepseek-v4.1-flash (fully tested and validated)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions