dagger/dagger · error

%q: get value: %w

Error message

%q: get value: %w

What it means

dagqlValue (core/modtree.go:662) wraps a failure from boundWorkspaceArgs when selecting a root node's main object. boundWorkspaceArgs (core/modtree.go:739) resolves the required Workspace argument for the object's constructor; if the workspace value cannot be resolved (workspaceArgValue fails), the selection cannot proceed and this error prefixes the node path to the cause.

Source

Thrown at core/modtree.go:662

	// lists
	// FIXME: as an optimization, one-shot when possible?
	srv := node.DagqlServer
	// 1. Are we the root? Select the module's main object from Query root.
	// A node is also treated as root if its parent is a synthetic naming-only
	// node (e.g. injected by workspace checks reparenting, which sets
	// Parent to an empty ModTreeNode with nil Module).
	if node.Parent == nil || node.Parent.Module.Self() == nil {
		mod := node.Module.Self()
		if mod == nil {
			return fmt.Errorf("%q: get value: missing module", node.PathString())
		}
		var ctor *Function
		if objType := node.ObjectType(); objType != nil && objType.Constructor.Valid {
			ctor = objType.Constructor.Value.Self()
		}
		args, err := boundWorkspaceArgs(ctx, srv, ctor)
		if err != nil {
			return fmt.Errorf("%q: get value: %w", node.PathString(), err)
		}
		return srv.Select(ctx, srv.Root(), dest, dagql.Selector{
			Field: gqlFieldName(mod.Name()),
			Args:  append(args, leafArgs...),
		})
	}
	// 2. Is parent an object?
	if parentObjType := node.Parent.ObjectType(); parentObjType != nil {
		var parentObjValue dagql.AnyObjectResult
		if err := node.Parent.DagqlValue(ctx, &parentObjValue); err != nil {
			return err
		}
		fn, _ := parentObjType.FunctionByName(node.Name)
		args, err := boundWorkspaceArgs(ctx, srv, fn)
		if err != nil {
			return fmt.Errorf("%q: get value: %w", node.PathString(), err)
		}
		return srv.Select(dagql.WithNonInternalTelemetry(ctx), parentObjValue, dest, dagql.Selector{

View on GitHub (pinned to 82ba2681db)

Solutions

  1. Ensure a workspace is bound into the context (or a session ambient workspace exists) before evaluating the node
  2. Make the Workspace argument optional in the object's constructor if it doesn't need to be required
  3. Fix the wrapped error from workspaceArgValue reported after the node path in the message
Defensive patterns

Strategy: validation

Validate before calling

// ensure a workspace is resolvable before evaluating a workspace-requiring root object
if ws == nil {
    ctx = core.WithBoundWorkspace(ctx, ws) // bind the enclosing workspace
}

Try / catch

if err := node.DagqlValue(ctx, &dest); err != nil {
    if strings.Contains(err.Error(), "get value:") {
        return fmt.Errorf("root %q needs a workspace in context: %w", node.PathString(), err)
    }
    return err
}

Prevention

When it happens

Trigger: Calling DagqlValue or RunAgent on a root ModTreeNode whose object type declares a non-optional Workspace argument, and the workspace value cannot be resolved from the context (no BoundWorkspace threaded) nor the session's ambient workspace.

Common situations: Evaluating a generator/workspace object outside a group where no workspace was bound into the context and no ambient session workspace exists; running a check or agent whose constructor requires a Workspace but the enclosing query lost it.

Related errors


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