plandex-ai/plandex · error

Error getting tell sys prompt for dry run token calculation

Error message

Error getting tell sys prompt for dry run token calculation

What it means

Thrown during the dry-run token calculation path (dryRunCalculateTokensWithoutContext) when generating the tell system prompt fails. Special case: if the underlying error equals AllTasksCompletedMsg, it is downgraded to an informational notification telling the user there is no current task and they should send a prompt instead of 'continue'; otherwise it's reported as a server error and a 500 ApiError is emitted.

Source

Thrown at app/server/model/plan/tell_exec.go:625

		hasAssistantReply:   state.hasAssistantReply,
		modelContext:        state.modelContext,
		activePlan:          state.activePlan,
	}

	sysParts, err := clone.getTellSysPrompt(getTellSysPromptParams{
		contextTokenLimit:    tentativeMaxTokens,
		dryRunWithoutContext: true,
	})

	if err != nil {
		log.Printf("error getting tell sys prompt for dry run token calculation: %v", err)

		msg := "Error getting tell sys prompt for dry run token calculation"
		if err.Error() == AllTasksCompletedMsg {
			msg = "There's no current task to implement. Try a prompt instead of the 'continue' command."
			go notify.NotifyErr(notify.SeverityInfo, msg)
		} else {
			go notify.NotifyErr(notify.SeverityError, fmt.Errorf("error getting tell sys prompt for dry run token calculation: %v", err))
		}

		state.activePlan.StreamDoneCh <- &shared.ApiError{
			Type:   shared.ApiErrorTypeOther,
			Status: http.StatusInternalServerError,
			Msg:    msg,
		}
		return false, 0
	}

	clone.messages = []types.ExtendedChatMessage{
		{
			Role:    openai.ChatMessageRoleSystem,
			Content: sysParts,
		},
	}

	promptMessage, ok := clone.resolvePromptMessage(unfinishedSubtaskReasoning)

View on GitHub (pinned to e2d772072e)

Solutions

  1. If the message says there's no current task: send a normal prompt instead of 'continue'
  2. Check plan state has a valid current task/summary before continuing
  3. Inspect server logs for the wrapped 'error getting tell sys prompt' detail to fix the underlying prompt-building failure

Example fix

// before
plz continue  # all tasks done
// error: Error getting tell sys prompt for dry run token calculation
// after
plz implement add login form  # start a new task, or add new tasks to the plan first
Defensive patterns

Strategy: try-catch

Validate before calling

// before sending 'continue', confirm there is an active task
if plan.CurrentTask == nil || plan.AllTasksCompleted() {
    return errors.New("no active task; send a prompt instead of 'continue'")
}

Try / catch

if apiErr := <-state.activePlan.StreamDoneCh; apiErr != nil {
    if strings.Contains(apiErr.Msg, "no current task") {
        // informational: switch to sending a prompt
    } else if strings.Contains(apiErr.Msg, "dry run token calculation") {
        // inspect server logs for wrapped sys-prompt build failure
    }
}

Prevention

When it happens

Trigger: Calling the tell flow with 'continue' when no task is active (AllTasksCompletedMsg), or any failure building the sys prompt (missing plan summary/context data) during dry-run token estimation.

Common situations: User runs 'continue' after all implementation tasks finished; plan state missing a current task; corrupted plan summary causing prompt construction to fail.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/132faf4f5135b34a. Report an issue: GitHub.