leptos-rs/leptos · warning

[HOT RELOADING] Child at

Error message

[HOT RELOADING] Child at 

What it means

childAtPath could not descend the given path: the current element has no `children` array and no `start`/`end` marker range to lazily rebuild children from. It logs a warning and returns the current element, so the patch proceeds against the wrong node (a shallower subtree) rather than failing loudly — the patch may then be applied to an incorrect DOM location.

Source

Thrown at leptos_hot_reload/src/patch.js:456

  function childAtPath(element, path) {
    if (path.length == 0) {
      return element;
    } else if (element.children) {
      const next = element.children[path[0]],
        rest = path.slice(1);
      return childAtPath(next, rest);
    } else if (path == [0]) {
      return element;
    } else if (element.start && element.end) {
      const actualChildren = childrenFromRange(
        element.node || element.start.parentElement,
        element.start,
        element.end,
      );
      return childAtPath({ children: actualChildren }, path);
    } else {
      console.warn("[HOT RELOADING] Child at ", path, "not found in ", element);
      return element;
    }
  }

  function childrenFromRange(parent, start, end) {
    const range = new Range();
    range.setStartAfter(start);
    range.setEndBefore(end);
    return buildActualChildren(parent, range);
  }

  function fromHTML(html) {
    const template = document.createElement("template");
    template.innerHTML = html;
    return template.content.cloneNode(true);
  }
}

View on GitHub (pinned to 32d20f6c9d)

Solutions

  1. Hard-reload the page and re-save so paths are computed against a fresh DOM.
  2. Verify the path indexes in the logged warning against the actual view structure; an off-by-one usually means a sibling was added/removed.
  3. Ensure leptos and leptos_hot_reload crate versions are in sync.
  4. Apply structural edits one at a time rather than batching several subtree changes per save.
Defensive patterns

Strategy: validation

Validate before calling

// Before applying a patch path, confirm it resolves:
const child = childAtPath(root, patch.path);
if (child === root && patch.path.length > 0) {
  console.warn('path unresolved, forcing reload');
  location.reload();
}

Prevention

When it happens

Trigger: A patch path is deeper than the actual child tree — e.g. path indexes past the rebuilt children, or the intermediate child resolved to a 'text'/'unit' node with no children; also when element.children exists but path[i] is out of bounds (element.children[path[0]] is undefined and the next recursion hits this branch).

Common situations: Version mismatch between the server's path computation and the client's child model; DOM edited between saves so indexes shifted; editing inside views leptos does not mark (dynamic children without markers).

Related errors


AI-assisted analysis of leptos-rs/leptos@32d20f6c9d (2026-09-01). Data as JSON: /api/errors/e901508e04bff81b. Report an issue: GitHub.