plandex-ai/plandex · warning

User does not have permission to archive plan

Error message

User does not have permission to archive plan

What it means

This 403 is returned by authorizePlanArchive when the plan is accessible but the requester is neither the plan owner nor holds shared.PermissionArchiveAnyPlan. Archiving (and unarchiving, via ArchivePlanHandler/UnarchivePlanHandler) is limited to the owner or users with the archive-any-plan admin permission.

Source

Thrown at app/server/handlers/auth_helpers.go:746

	if plan.OwnerId != auth.User.Id && !auth.HasPermission(shared.PermissionRenameAnyPlan) {
		log.Println("User does not have permission to rename plan")
		http.Error(w, "User does not have permission to rename plan", http.StatusForbidden)
		return nil
	}

	return plan
}

func authorizePlanArchive(w http.ResponseWriter, planId string, auth *types.ServerAuth) *db.Plan {
	plan := authorizePlan(w, planId, auth)

	if plan == nil {
		return nil
	}

	if plan.OwnerId != auth.User.Id && !auth.HasPermission(shared.PermissionArchiveAnyPlan) {
		log.Println("User does not have permission to archive plan")
		http.Error(w, "User does not have permission to archive plan", http.StatusForbidden)
		return nil
	}

	return plan
}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Have the plan owner or an admin with PermissionArchiveAnyPlan archive/unarchive the plan
  2. Grant PermissionArchiveAnyPlan to the automation account if scheduled archiving is required
  3. Hide archive toggles for non-owners lacking the permission
  4. Transfer ownership if the current owner is unavailable

Example fix

// before
await api.archivePlan(planId);
// after
if (plan.ownerId !== auth.userId && !auth.permissions.includes('archive_any_plan')) {
  throw new Error('Only the plan owner or an admin can archive this plan');
}
await api.archivePlan(planId);
Defensive patterns

Strategy: type-guard

Validate before calling

function canArchivePlan(plan, auth) {
  return plan.ownerId === auth.userId || auth.permissions.includes('archive_any_plan');
}

Type guard

function isPlanOwner(plan, auth) {
  return typeof plan?.ownerId === 'string' && plan.ownerId === auth?.userId;
}

Try / catch

try {
  return await api.archivePlan(planId);
} catch (e) {
  if (e.status === 403 && /permission to archive plan/.test(e.body)) {
    notifyUser('Only the plan owner or an admin can archive this plan');
    return null;
  }
  throw e;
}

Prevention

When it happens

Trigger: ArchivePlanHandler or UnarchivePlanHandler called by a non-owner member lacking PermissionArchiveAnyPlan attempting to change the plan's archived state.

Common situations: A member tries to archive a completed team plan owned by someone else; batch-archival automation runs with insufficient token scope; stale UI offering archive toggles after a role change.

Understand the failure class

Background: "You do not have permission" / 403 Forbidden errors: authenticated but not allowed — causes and fixes across open-source libraries — this error's family across 31 libraries.

Related errors


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