Skip to content

panic: reflect: slice index out of range in plugins.templateSysData #344

Description

@Yogeshwar-Pawade

Summary

json.Marshal inside pkg/plugins.templateSysData (pkg/plugins/common.go:36) panics with reflect: slice index out of range. The panic occurs on a goroutine the executor's DAG runner created (trace below). It is not a fail-stop: the process dies, the rest of the stage is silently skipped, and boot continues.

Affected versions

  • v1.25.1 — the version that panicked (used by kairos-io/immucore v0.20.3)
  • v1.24.0 — used by kairos-io/kairos-agent v2.29.4; identical code at the same lines
  • master, as of 2026-09-24 (latest tag v1.26.4) — still present

Stack trace (excerpt; DAG-runner module path redacted), v1.25.1

panic: reflect: slice index out of range [recovered, repanicked]

goroutine 297 [running]:
reflect.Value.Index({0x..., 0x..., ...}, 0x0)
        reflect/value.go:1424
encoding/json.arrayEncoder.encode(...)
        encoding/json/encode.go:890
encoding/json.sliceEncoder.encode(...)
        encoding/json/encode.go:863
encoding/json.structEncoder.encode(...)
        encoding/json/encode.go:747
encoding/json.ptrEncoder.encode(...)
        encoding/json/encode.go:919
encoding/json.(*encodeState).marshal(...)
        encoding/json/encode.go:343
encoding/json.Marshal(...)
        encoding/json/encode.go:209
github.com/mudler/yip/pkg/plugins.templateSysData(...)
        /go/pkg/mod/github.com/mudler/yip@v1.25.1/pkg/plugins/common.go:36
github.com/mudler/yip/pkg/plugins.IfConditional(...)
        /go/pkg/mod/github.com/mudler/yip@v1.25.1/pkg/plugins/if.go:13
github.com/mudler/yip/pkg/executor.(*DefaultExecutor).applyStage(...)
        /go/pkg/mod/github.com/mudler/yip@v1.25.1/pkg/executor/default.go:82
github.com/mudler/yip/pkg/executor.(*DefaultExecutor).genOpFromSchema.func1(...)
        /go/pkg/mod/github.com/mudler/yip@v1.25.1/pkg/executor/default.go:165
<dag-runner>.(*Graph).Run.func3(...)
        <dag-runner>@v0.4.2/dag.go:159
created by <dag-runner>.(*Graph).Run in goroutine 288
        <dag-runner>@v0.4.2/dag.go:158

Impact

On a host running immucore v0.20.3 (pins yip v1.25.1) the panic fired in the initramfs stage, ~2 of ~25 steps complete:

  • immucore.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
  • Failed to start immucore. → Dependency failed for Initrd Default Target.
  • Boot continued. Because the process exited, the remaining stages — including the one applying the required kernel sysctls (vm.overcommit_memory=1, kernel.panic=10, kernel.panic_on_oops=1) — never ran.
  • kubelet then crash-looped under protect-kernel-defaults=true: invalid kernel flag: vm/overcommit_memory, expected value: 1, actual value: 0 / kernel/panic, expected 10 actual 5 / kernel/panic_on_oops, expected 1 actual 0

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions