plandex-ai/plandex · error

Error getting tell sys prompt: %v

Error message

Error getting tell sys prompt: %v

What it means

execTellPlan builds the system prompt via state.getTellSysPrompt(getTellSysPromptParams). On failure the error is logged, reported, and pushed to StreamDoneCh as a 500 ApiError "Error getting tell sys prompt: %v". The tell run aborts because the system prompt — which includes context maps and instructions — could not be constructed.

Source

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

					autoOnly:            true,
				})
			}
		}
	}

	getTellSysPromptParams := getTellSysPromptParams{
		planStageSharedMsgs:   planStageSharedMsgs,
		planningPhaseOnlyMsgs: planningPhaseOnlyMsgs,
		implementationMsgs:    implementationMsgs,
		contextTokenLimit:     tentativeMaxTokens,
	}

	// log.Println("getTellSysPromptParams:\n", spew.Sdump(getTellSysPromptParams))

	sysParts, err := state.getTellSysPrompt(getTellSysPromptParams)
	if err != nil {
		log.Printf("Error getting tell sys prompt: %v\n", err)
		go notify.NotifyErr(notify.SeverityError, fmt.Errorf("error getting tell sys prompt: %v", err))

		active.StreamDoneCh <- &shared.ApiError{
			Type:   shared.ApiErrorTypeOther,
			Status: http.StatusInternalServerError,
			Msg:    fmt.Sprintf("Error getting tell sys prompt: %v", err),
		}
		return
	}

	// log.Println("**sysPrompt:**\n", spew.Sdump(sysParts))

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

View on GitHub (pinned to e2d772072e)

Solutions

  1. Read the wrapped error in the message/logs — it names the failing prompt component (context map, template, file read).
  2. Verify all files in the plan context still exist and are readable on disk; remove/re-add missing ones.
  3. Check custom rules/instruction files for syntax problems and fix or remove them.
  4. Retry the tell request after repairing the context state.
Defensive patterns

Strategy: try-catch

Validate before calling

// ensure every context file is readable before telling
for path := range plan.ContextMap() {
    f, err := os.Open(path)
    if err != nil {
        return fmt.Errorf("unreadable context file %s: %w", path, err)
    }
    f.Close()
}

Try / catch

apiErr := <-active.StreamDoneCh
if strings.HasPrefix(apiErr.Msg, "Error getting tell sys prompt") {
    cause := strings.TrimPrefix(apiErr.Msg, "Error getting tell sys prompt: ")
    log.Printf("sys prompt build failed: %s", cause)
    // fix the named component (missing file/template) then retry
    return retryTell(planId, branch)
}

Prevention

When it happens

Trigger: getTellSysPrompt returns an error for the given TellSysPromptParams during execTellPlan: failures building the context map (unreadable files in plan context), errors rendering prompt templates, or downstream context/token estimation errors while assembling prompt parts.

Common situations: Files in the plan context were deleted or made unreadable on disk after being loaded; template/rule files with invalid syntax; context map generation failing on binary or undecodable files; DB errors fetching context entries.

Related errors


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