Skip to content

vm create: applyCueDefaults fails with 'cannot convert non-concrete value bool/string' for every VM entity, manifest-independent #50

Open

Description

@aitrawog

Finding

charly vm create fails for every VM entity, with a CUE defaults-application error naming a field that
the project's own manifest does set or default. Two different repos, two different fields, same
mechanism, minutes apart:

# charly-ubuntu's check-ubuntu-repo bed
charly: error: command "vm": applying vm defaults for "ubuntu-repo-vm":
  applyCueDefaults vm: decode: autostart: cannot convert non-concrete value bool

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

Both beds had built their disks successfully seconds earlier ([vm-build] PASS 15.7 s and 5 m 5.8 s),
so this is the create leg only.

Mechanism and the control that clears the change under test

applying vm defaults for is emitted by plugin-vm (vm_host_seams.go); applyCueDefaults lives in
plugin-substrate (validate_vm.go). The decode is asking CUE for a concrete value of a field whose
schema carries a TYPE (bool, string) with no default filled in, and failing.

A/B, to rule out the consumer side: the same bed was re-run with the PREVIOUS commit's manifest
(705dd28's charly.yml, i.e. without the guest-is-resolute step that was under review) against the
same binary:

[vm-build]  PASS 15.707s
[vm-create] FAIL 503ms   <- identical error, same field

So the failure does not depend on the project's manifest: it is on the defaults-application path itself.

Timeline, which is the useful part: the same bed on the same binary created its VM successfully
earlier ([vm-create] PASS 943ms, 2026.320.1458), then failed from 2026.320.1519 onward. Something
in the environment changed between those runs — a plugin view / schema resolution — not in the repos.

Blast radius

Every VM bed and every charly vm create, i.e. all kind: vm work, on a host where the plugin
schema/default resolution is in this state. It is not repo-specific and not manifest-specific, so it
blocks unrelated work (two separate Ubuntu legs here) identically.

Root-fix pointer

The decode must see the schema's DEFAULTS, not its bare types: either the vendored vm CUE schema is not
being resolved on this path, or a cached plugin/schema view is being served in a state where the
defaults are absent. Worth checking, in this order: the plugin-view/schema resolution for the vm kind on
a cold vs warm cache, and whether applyCueDefaults falls back to a type-only schema when resolution
fails instead of erroring on the missing default.

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 — a mechanism I did not have when I filed this: LOCAL OVERRIDES leak in from OTHER sessions' worktrees

    Chasing the "worked at 15:19, fails from 15:22" timeline, I captured the plugin resolution lines from an
    ordinary charly box build on this host. 20 plugins resolved from another session's uncommitted
    worktree
    , in MY process:

    $ grep -ohE 'plugin [^:]+: using LOCAL OVERRIDE [^ ]*' build.log | sort -u | head -6
    plugin github.com/opencharly/plugin-adb/...:      using LOCAL OVERRIDE .worktrees/wave-a/plugin-adb
    plugin github.com/opencharly/plugin-cstream/...:  using LOCAL OVERRIDE .worktrees/wave-script/plugin-cstream
    plugin plugin-cdp:                                using LOCAL OVERRIDE .worktrees/wave-script/plugin-cdp
    plugin plugin-mcp:                                using LOCAL OVERRIDE .worktrees/wave-c/plugin-mcp
    plugin plugin-record:                             using LOCAL OVERRIDE .worktrees/wave-c/plugin-record
    …(20 lines total, from wave-a / wave-c / wave-script, plus one from my own session)
    

    So resolution prefers a LOCAL OVERRIDE found anywhere under .worktrees/<slug>/<repo> on this host —
    including another agent's half-finished edit. For a plugin that serves a SCHEMA, that means my process can
    be decoding against a schema that is not on any merged ref.

    Two further observations that make this the leading candidate rather than a curiosity:

    1. The schema repo is checked out in other sessions' worktrees. .worktrees/ holds spec and sdk
      checkouts for several sessions (one slug is literally cache-root-resolver). spec is the CUE
      single-source for the entity schemas, so an override there is exactly how a field could arrive typed
      but undefaulted — the shape my error names.
    2. A distro vanished from resolution in the same window. charly box validate reported 7 distros
      earlier in this session and reports 6 distros now, on two unrelated projects. I could not make
      that number move by any edit of mine (the projects' defaults: blocks diff clean against
      origin/main).

    That does not prove this is the cause — the failing plugin is plugin-vm/plugin-substrate, and I did not
    find either under .worktrees/. But it does mean the diagnosis cannot be trusted until the resolution
    path is shown to be free of cross-session overrides: a repro attempt on a host where 20 plugins come from
    someone else's working tree is not a clean experiment.

    Ask: (a) is the LOCAL OVERRIDE lookup supposed to be host-global, or scoped to the invoking session's
    own slug? (b) if host-global, is a plugin serving a SCHEMA safe to override from an arbitrary worktree?
    That question alone may be the root cause, and it is worth answering before anyone debugs the decode.

    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 — four candidate causes ELIMINATED, so the remaining space is narrower

    Continuing to narrow this rather than guess. Each line below is a test I ran and its result; none of
    them is a theory.

    candidate test result
    the consumer's manifest A/B: same bed, previous commit's charly.yml (705dd28) on the same binary eliminated — identical applyCueDefaults vm: decode: autostart: cannot convert non-concrete value bool
    my edit corrupted the project's defaults: git diff origin/main -- charly.yml on the defaults: block eliminated — clean, only the intended URL/prose edits
    concurrent VM beds racing for state retried with ps showing zero charly processes eliminated — fails alone
    stale git-ref resolution charly cache clear (582 entries dropped), then retry eliminated — "git-ref cache cleared — the next resolution is fresh", then the identical error
    host-level vm defaults grepped ~/.config/charly/charly.yml (1789 lines) for defaults: / vm: / autostart / backend: eliminated — no vm defaults configured there at all

    What the elimination leaves. A field the schema is supposed to DEFAULT (backend string,
    autostart bool) arrives typed but not defaulted, in two different projects, one of which does not
    declare the field at all and one of which sets it explicitly — so it is not the entities, it is the
    defaults being applied to them. Between a passing run at 2026.320.1458 and a failing one at
    2026.320.1519 on the SAME binary, nothing in either repo changed.

    Still the strongest untested lead is the one from my previous comment: 20 plugins resolve from other
    sessions' worktrees in my process (using LOCAL OVERRIDE .worktrees/wave-*/…), and .worktrees/ holds
    spec/sdk checkouts. A plugin VIEW cached from such a tree is the one place a schema could change
    without any merged ref moving. I have not touched those views — deleting another session's cached
    artifacts is not something I will do to make a build pass (R3).

    Ask unchanged: whether a plugin that serves a SCHEMA is safe to override from an arbitrary
    worktree, and whether the override lookup should be host-global. If the answer is "no" and "it should
    not be", this issue is that defect and the decode is its symptom.

    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

    STATUS — fifth candidate eliminated: it is NOT disk capacity

    The host was at 99% (5.2 GiB free). I freed 35 GiB (a stale shared plugin cache, with operator
    approval), taking it to 71 GiB free / 83%, and re-ran the same command immediately:

    $ df -h /            ->  71G free, 83% used
    $ charly -C <project> vm create ubuntu-debootstrap
    charly: error: command vm: applying vm defaults for ubuntu-debounce...
      applyCueDefaults vm: decode: backend: cannot convert non-concrete value string (and 1 more errors)
    

    Identical. So a silently-failing cache or temp write under disk pressure is not the mechanism, and
    the earlier ENOSPC failures I filed separately (opencharly/charly#1170) are a different defect that
    merely shared a symptom.

    Updated elimination table:

    candidate result
    the consumer's manifest eliminated (A/B against the previous commit's charly.yml)
    the project's defaults: eliminated (diff clean)
    concurrency eliminated (fails with zero charly processes)
    stale git-ref resolution eliminated (charly cache clear, then identical)
    host-level vm defaults eliminated (none configured)
    disk capacity / partial cache writes eliminated (35 GiB freed, identical failure)

    What remains standing is the schema/defaults path itself, and the untested lead from earlier: 20 plugins
    resolve from other sessions' worktrees (using LOCAL OVERRIDE .worktrees/wave-*/…) and .worktrees/
    holds spec/sdk checkouts, so a cached plugin VIEW built from such a tree is the one place a schema
    can change without any merged ref moving.

    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 — I think I have the mechanism, and it is a zero-value round-trip, not a schema resolution failure

    I traced applyCueDefaults to its implementation: sdk/loaderkit/cue_validate.go (ApplyCueDefaults,
    line ~135-175), with the kind→def table in sdk/loaderkit/cue_schema.go ("vm": "#Vm"). What that code
    does, in order:

    b, err := yaml.Marshal(out)                    // 1. the RESOLVED GO STRUCT -> YAML
    af, err := cueyaml.Extract("defaults", b)      // 2.
    cv := cueSchemaCtx().BuildFile(af)             // 3.
    merged := cv.Unify(def)                        // 4. def = #Vm from the EMBEDDED schema
    if err := merged.Decode(out); err != nil {     // 5. <- our error
        return fmt.Errorf("applyCueDefaults %s: decode: %w", kind, err)

    Two facts from the schema and the entity that together produce our error:

    1. schema/vm.cue declares BOTH failing fields as required-with-default:
      backend: *"auto" | "libvirt" | "qemu" and autostart: *false | true. The package doc is explicit
      that "Only REQUIRED-with-default schema fields materialize — an optional-with-default field
      (field?: *x) stays absent on unify and does not reach the struct".
    2. The entity does not set either field. Measured with charly box inspect ubuntu-debootstrap: no
      backend and no autostart key appears in the resolved entity at all.

    So step 1 marshals the RESOLVED GO STRUCT, not the source YAML — and a Go zero value for a
    string/bool field marshals as backend: "" / autostart: false unless those fields carry
    omitempty. "" is outside *"auto" | "libvirt" | "qemu", so the unify in step 4 cannot produce a
    concrete value for it, and step 5 reports exactly what we see:

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

    autostart: false is inside its union and would be fine, which is why the error names backend first and
    adds "(and 1 more errors)" for the rest of the same subtree.

    The guard that should have caught this is one line above: cueKindDef(kind) returns ok if the KIND
    is registered — not if the unify can produce a concrete value — so applyCueDefaults: no CUE schema registered for kind never fires and the failure surfaces later, as an opaque decode error naming a field
    the user never set.

    Root-fix directions, in the order I would try them:

    1. marshal with zero values omitted (omitempty, or a small omitZero pass) so absent fields stay
      absent and the schema default fills them — which is what the package doc promises;
    2. or unify the ORIGINAL resolved YAML rather than a struct round-trip;
    3. and make the failure speak: if the unify leaves a required-with-default field non-concrete, name THAT
      ("field backend has no concrete value and the schema default did not apply") instead of a decode type
      error.

    This also explains why the timeline confused me: nothing in the repos or the cache changed. The change has
    to be in which fields are required-with-default in the spec the binary embeds, or in the Go struct's
    marshalling tags — a one-line difference that turns every VM entity that omits backend from working to
    failing. git log -S 'backend: *"auto"' in spec over the last day, and the same for omitempty on
    VmSpec.Backend in sdk/charly, should find it immediately.

    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

    CORRECTION — my previous comment's mechanism was wrong; the cause is a spec regression, and it is now filed

    I claimed ApplyCueDefaults was broken by a missing omitempty, so a Go zero value (backend: "") was
    re-ingested and failed to unify. That is false, and I checked it before it went further:

    $ grep -n 'Backend .*json:' spec@.../spec/cue_types_gen.go
    6258:  Backend string `yaml:"backend,omitempty" json:"backend,omitempty"`
    $ grep -n 'Autostart .*json:' …
    8485:  Autostart bool `yaml:"autostart,omitempty" json:"autostart,omitempty"`
    

    Both zero values are OMITTED, so nothing empty is marshalled and the unify gets a clean entity — my
    mechanism could not have produced the error.

    The real cause, measured by diffing the spec version this binary embeds against the previous one:

    #Vm.backend #Vm.autostart
    [email protected] backend: *"auto" | "libvirt" | "qemu" — with default autostart: *false | true — with default
    [email protected] (embedded now) backend!: string — no default autostart!: bool — no default

    ApplyCueDefaults materializes only REQUIRED-with-default fields — its own doc says a non-defaulted
    field "only turns an absent value into a non-concrete DECODE error in applyCueDefaults". Every VM entity
    in the org omits these two, because they used to be filled in.

    Measured fix: set them explicitly and vm create works immediately —

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

    Filed as opencharly/spec#341 with the version diff, the blast radius (every VM entity, and it is
    invisible to box validate) and the two options: restore the defaults, or migrate every entity and
    declare the break.

    So this issue's subject — the decode error — is a SYMPTOM of #341, and this thread can close once #341 is
    answered. The six eliminations above were all real work and none of them was the cause; the cause was one
    schema version.

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

  6. added
    category:runtime
    type:fix
    on Nov 23, 2026
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

    category:runtimetype:fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions