PlannerGoalNotAchievableError
semantic_kernel.exceptions.PlannerGoalNotAchievableError
Stack trace
semantic_kernel.exceptions.PlannerGoalNotAchievableError: The planner could not find a plan to achieve the goal with the given skills and context. at semantic_kernel.planning.Planner.plan_async (planner.py:123) at main.py:45
Why it happens
The Semantic Kernel planner attempts to create a sequence of skills and actions to fulfill the user's goal. This error occurs when the planner cannot find any valid combination of registered skills or cannot satisfy constraints to achieve the goal. It often happens if the goal is too vague, no relevant skills are registered, or the prompt/context is insufficient for planning.
Detection
Catch PlannerGoalNotAchievableError exceptions around planner calls and log the goal and registered skills to detect when planning fails before crashing.
Causes & fixes
No skills registered that can fulfill the specified goal
Register appropriate skills with the kernel that directly relate to the goal before invoking the planner.
Goal is too vague or ambiguous for the planner to generate a plan
Refine the goal prompt to be more specific and actionable, providing clearer instructions or constraints.
Insufficient context or missing required parameters for skills
Ensure all required context variables and parameters are provided to the planner and skills before planning.
Planner configuration or skill metadata mismatch causing plan generation failure
Verify skill metadata and planner configuration are correct and compatible with the goal and kernel version.
Code: broken vs fixed
from semantic_kernel import Kernel
kernel = Kernel()
# No skills registered
goal = "Write a summary of today's news"
plan = kernel.planner.plan_async(goal) # This line raises PlannerGoalNotAchievableError
print(plan) import os
from semantic_kernel import Kernel
os.environ['SEMANTIC_KERNEL_API_KEY'] = os.getenv('SEMANTIC_KERNEL_API_KEY') # Use env var for keys
kernel = Kernel()
# Register a skill relevant to news summarization
kernel.register_skill('NewsSummarySkill', NewsSummarySkill())
goal = "Write a summary of today's news"
plan = kernel.planner.plan_async(goal) # Fixed: skills registered and goal clear
print(plan) Workaround
Wrap the planner call in try/except PlannerGoalNotAchievableError, then fallback to a default static plan or prompt the user to refine the goal.
Prevention
Design your system to always register comprehensive skills covering expected goals and validate goal clarity before planning to prevent this error.