wavetermdev/waveterm · error

no jobid in authenticatejobmanager message

Error message

no jobid in authenticatejobmanager message

What it means

The AuthenticateJobManagerVerify RPC payload must carry a non-empty JobId identifying the job record to verify against. An empty JobId means the caller built CommandAuthenticateJobManagerData without setting JobId, so there is nothing to look up in wstore.

Source

Thrown at pkg/wshutil/wshrouter_controlimpl.go:223

		return wshrpc.CommandAuthenticateRtnData{}, fmt.Errorf("no rpccontext in token response")
	}
	if rtnData.RouteId == "" {
		return wshrpc.CommandAuthenticateRtnData{}, fmt.Errorf("no routeid in token response")
	}
	log.Printf("wshrouter authenticate-token success linkid=%d routeid=%q", linkId, rtnData.RouteId)
	impl.Router.trustLink(linkId, LinkKind_Leaf)
	impl.Router.bindRoute(linkId, rtnData.RouteId, true)

	return rtnData, nil
}

func (impl *WshRouterControlImpl) AuthenticateJobManagerVerifyCommand(ctx context.Context, data wshrpc.CommandAuthenticateJobManagerData) error {
	if !impl.Router.IsRootRouter() {
		return fmt.Errorf("authenticatejobmanagerverify can only be called on root router")
	}

	if data.JobId == "" {
		return fmt.Errorf("no jobid in authenticatejobmanager message")
	}
	if data.JobAuthToken == "" {
		return fmt.Errorf("no jobauthtoken in authenticatejobmanager message")
	}

	job, err := wstore.DBMustGet[*waveobj.Job](ctx, data.JobId)
	if err != nil {
		log.Printf("wshrouter authenticate-jobmanager-verify error jobid=%q: failed to get job: %v", data.JobId, err)
		return fmt.Errorf("failed to get job: %w", err)
	}

	if job.JobAuthToken != data.JobAuthToken {
		log.Printf("wshrouter authenticate-jobmanager-verify error jobid=%q: invalid jobauthtoken", data.JobId)
		return fmt.Errorf("invalid jobauthtoken")
	}

	log.Printf("wshrouter authenticate-jobmanager-verify success jobid=%q", data.JobId)
	return nil

View on GitHub (pinned to a4447c1563)

Solutions

  1. Set data.JobId from the created job record before calling the RPC.
  2. Confirm the job was successfully created and its id persisted before attempting verification.
  3. Check the JSON/RPC serialization to ensure the jobid field is transmitted.
  4. Validate the payload client-side and fail fast before sending the RPC.

Example fix

// before
_, err := wshRpc.SendRpcRequest(wshrpc.Command_AuthenticateJobManagerVerify, wshrpc.CommandAuthenticateJobManagerData{JobAuthToken: tok}, opts)
// after
if data.JobId == "" {
    return fmt.Errorf("cannot verify job: JobId is empty")
}
_, err := wshRpc.SendRpcRequest(wshrpc.Command_AuthenticateJobManagerVerify, data, opts)
Defensive patterns

Strategy: validation

Validate before calling

if data.JobId == "" {
    return fmt.Errorf("JobId is required for job-manager verification")
}
// safe to call RPC

Type guard

func jobDataComplete(d wshrpc.CommandAuthenticateJobManagerData) bool {
    return d.JobId != ""
}

Try / catch

err := verifyJobManager(ctx, data)
if err != nil && strings.Contains(err.Error(), "no jobid in authenticatejobmanager message") {
    return fmt.Errorf("caller bug: build the data struct with a real JobId: %w", err)
}

Prevention

When it happens

Trigger: Sending Command_AuthenticateJobManagerVerify with CommandAuthenticateJobManagerData{JobId: ""} — e.g. job id never assigned, zero-value struct passed, or field lost during serialization.

Common situations: Job creation failed upstream so the job (and its id) never got persisted before verification was attempted; copy-paste building the data struct omitting JobId; JSON field name mismatch dropping the value.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01). Data as JSON: /api/errors/3b9211886a3688fa. Report an issue: GitHub.