dagger/dagger · error

render config after delete

Error message

render config after delete: %w

What it means

DeleteConfigValue removes a key from dagger.toml and, when the key path contains quoted or all-digit segments that document-level edits cannot address, falls back to deleting from the parsed TOML tree and re-rendering the whole file. This error wraps a failure of that re-render (ToTomlString), meaning the in-memory TOML tree could not be serialized back to text after the deletion. It indicates an internal serialization problem with the tree produced by the TOML library, not a problem with the key the user asked to delete.

Solutions

  1. Retry the delete; if it reproduces, file a bug with the dagger.toml contents attached.
  2. Manually edit dagger.toml to remove the key, removing any unusual TOML value types or formatting first.
  3. Restore dagger.toml from version control or backup and re-apply edits incrementally.
  4. Run `dagger config read`/parse the file with a TOML linter to identify the construct that fails to round-trip.

Example fix

// before: dagger.toml contains a value type the renderer cannot emit
dagger config delete 'weird."quoted".key'
// error: render config after delete: ...

// after: normalize the odd construct by hand, then delete
# edit dagger.toml: replace exotic value with a plain scalar, save
# then re-run the delete
dagger config delete 'weird."quoted".key'
Defensive patterns

Strategy: try-catch

Try / catch

rendered, err := DeleteConfigValue(ctx, key)
if err != nil {
    if strings.Contains(err.Error(), "render config after delete") {
        // renderer failed to round-trip the TOML tree
        return fmt.Errorf("dagger.toml could not be re-serialized after delete; edit the file manually: %w", err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling DeleteConfigValue (directly or via withoutConfigValue) on a key whose collapsed path contains a segment that is quoted or all-digit (configPathRequiresSerializeFallback returns true), the tree.DeletePath succeeds, but tree.ToTomlString fails to render the modified TOML document.

Common situations: Very rare in practice: dagger.toml containing TOML constructs the renderer cannot round-trip (exotic value types), or a corrupted/corner-case TOML tree left by a third-party edit; typically surfaces as a bug report rather than a user mistake.

Related errors


AI-assisted analysis of dagger/dagger@82ba2681db (2026-09-05). Data as JSON: /api/errors/69f931c13953c8ab. Report an issue: GitHub.

Appendix: source

Thrown at core/workspace/config.go:864

	tree, err := toml.LoadBytes(existingData)
	if err != nil {
		return nil, fmt.Errorf("parse existing config: %w", err)
	}
	if tree.GetPath(parts) == nil {
		return nil, fmt.Errorf("key %q is not set", key)
	}

	collapsed := collapseEmptiedConfigTables(tree, parts)

	if configPathRequiresSerializeFallback(collapsed) {
		// Same trade-off as writes: document edits can't address quoted or
		// all-digit path segments, so fall back to a full canonical rewrite.
		if err := tree.DeletePath(collapsed); err != nil {
			return nil, fmt.Errorf("delete config path %q: %w", JoinConfigPath(collapsed...), err)
		}
		rendered, err := tree.ToTomlString()
		if err != nil {
			return nil, fmt.Errorf("render config after delete: %w", err)
		}
		cfg, err := ParseConfig([]byte(rendered))
		if err != nil {
			return nil, err
		}
		return SerializeConfig(cfg), nil
	}

	return deleteConfigDocumentPath(existingData, parts, collapsed)
}

// refuseProtectedConfigDelete rejects keys whose removal would break the
// containing entry rather than merely unset a value.
func refuseProtectedConfigDelete(parts []string, key string) error {
	switch {
	case parts[0] == "ports":
		return fmt.Errorf("cannot unset %q; edit or remove the [ports.<host>] section in dagger.toml", key)
	case parts[0] == "modules" && len(parts) >= 3 && parts[2] == "source":

View on GitHub (pinned to 82ba2681db)