vxcontrol/pentagi · error

memory is not available

Error message

memory is not available

What it means

The memory tool's Handle was invoked when m.IsAvailable() is false — i.e. the tool was constructed without a pgvector store (and related dependencies), so it cannot operate at all. It's an availability guard, not a runtime failure.

Source

Thrown at backend/pkg/tools/memory.go:44

)

type memory struct {
	flowID int64
	store  *pgvector.Store
	vslp   VectorStoreLogProvider
}

func NewMemoryTool(flowID int64, store *pgvector.Store, vslp VectorStoreLogProvider) Tool {
	return &memory{
		flowID: flowID,
		store:  store,
		vslp:   vslp,
	}
}

func (m *memory) Handle(ctx context.Context, name string, args json.RawMessage) (string, error) {
	if !m.IsAvailable() {
		return "", fmt.Errorf("memory is not available")
	}

	ctx, observation := obs.Observer.NewObservation(ctx)
	logger := logrus.WithContext(ctx).WithFields(enrichLogrusFields(m.flowID, nil, nil, logrus.Fields{
		"tool": name,
		"args": string(args),
	}))

	if m.store == nil {
		logger.Error("pgvector store is not initialized")
		return "", fmt.Errorf("pgvector store is not initialized")
	}

	switch name {
	case SearchInMemoryToolName:
		var action SearchInMemoryAction
		if err := json.Unmarshal(args, &action); err != nil {
			logger.WithError(err).Error("failed to unmarshal search in memory action arguments")

View on GitHub (pinned to ea665308ba)

Solutions

  1. Check startup logs for pgvector store initialization errors before the flow ran.
  2. Ensure the pgvector store is configured (DB URL with pgvector extension) so NewMemoryTool gets a non-nil store.
  3. Don't register the memory tool with agents when the store is nil — gate registration on availability.
  4. Verify DB migrations applied so the store constructor succeeds.

Example fix

// before: register unconditionally
tools = append(tools, NewMemoryTool(flowID, store, vslp))

// after: register only when available
if m := NewMemoryTool(flowID, store, vslp); m.IsAvailable() {
    tools = append(tools, m)
}
Defensive patterns

Strategy: type-guard

Validate before calling

func memoryAvailable(store *pgvector.Store) bool {
    return store != nil
}

Type guard

func withMemoryTool(store *pgvector.Store) Tool {
    if store == nil {
        return nil // caller must skip registration
    }
    return NewMemoryTool(flowID, store, vslp)
}

Try / catch

out, err := tool.Handle(ctx, "search_in_memory", args)
if err != nil && strings.Contains(err.Error(), "memory is not available") {
    log.Println("memory store disabled; continuing without memory lookup")
    return emptyResult, nil
}

Prevention

When it happens

Trigger: Calling search_in_memory (or any memory tool name) when NewMemoryTool received a nil store; this happens when the deployment has no pgvector store configured (DB not set up, vector-store disabled at startup) yet the tool was still registered with the agent.

Common situations: PostgreSQL/pgvector not configured in .env; vector store initialization failed at startup but tools were still registered; running flows against an environment without the memory feature enabled.

Related errors


AI-assisted analysis of vxcontrol/pentagi@ea665308ba (2026-09-01). Data as JSON: /api/errors/560adfebfc801af9. Report an issue: GitHub.