60+ Chef Interview Questions: Troubleshooting Runs (2027)

62 Chef interview questions on debugging Chef Infra Client runs: stack traces, why-run, attributes, Policyfiles, 401/403 errors and real scenarios.

Sep 16, 2025 - 11:34
Nov 5, 2026 - 08:54
 0  61
60+ Chef Interview Questions: Troubleshooting Runs (2027)

Chef troubleshooting interview questions test whether you can read a failed Chef Infra Client run and fix it: finding the stack trace, raising the log level, testing with why-run mode, checking run-lists, attribute precedence and Policyfile revisions, and fixing 401 or 403 errors from Chef Infra Server. This page has 62 questions focused on debugging real runs.

Most Chef question lists stop at definitions. This one assumes you already know what a cookbook is and asks what you do when the run goes red. For the definitions and the most common basics, start with our 45 most asked Chef Infra interview questions, and for quick one-line answers see the Chef FAQs quick reference. Commands and file paths below were checked against the Chef Infra Client 19 and Chef Workstation documentation in November 2026.

Key takeaways

  • Every failed run writes a stack trace, by default to /var/chef/cache/chef-stacktrace.out on Linux. Read it before anything else.
  • chef-client -l debug raises logging, -W (why-run) shows what would change without changing it, and -o runs a one-off run-list.
  • Chef Infra Client 19 was released in February 2026 as the long-term support line and is packaged with Chef Habitat instead of Omnibus. Version 18 left active support the same month.
  • Most "wrong value" bugs come from attribute precedence or from a node pinned to an old Policyfile revision or environment.
  • 401 errors usually mean a bad client key or a clock more than 15 minutes off. 403 errors mean the client lacks a permission on the object.

How Chef troubleshooting questions are asked

LevelWhat interviewers checkTypical prompt
FreshersWhere logs live, basic chef-client flags, run phases"The run failed. Where do you look first?"
2 to 5 yearsAttributes, notifications, guards, Policyfiles, Test Kitchen"A service restarts every run. Why?"
SeniorFleet health, server errors, rollout safety, upgrades"300 nodes stopped converging overnight."
Scenario roundCalm, ordered diagnosisLive debugging of a broken cookbook

Questions for freshers

1. A Chef Infra Client run failed. What do you check first?

Read the end of the run output and the stack trace file. The output names the resource and recipe that failed. The stack trace (by default /var/chef/cache/chef-stacktrace.out on Linux and C:\chef\cache\chef-stacktrace.out on Windows) holds the full Ruby backtrace.

2. How do you get more detail from a run?

Run chef-client -l debug. The -l or --log_level option accepts auto (the default), debug, info, warn, error and fatal. Debug output is long, so pipe it to a file.

3. What is why-run mode and when is it useful?

Why-run (chef-client -W) does everything except change the system and reports what it would have done. It helps you preview a change on a production node. Chef's docs warn it is not a replacement for testing, because a resource that depends on an earlier change cannot be predicted accurately.

sudo chef-client -W -l info

4. What are the two main phases of a Chef run and why do they matter when debugging?

The compile phase loads cookbooks and evaluates recipe Ruby to build the resource collection. The converge phase executes those resources in order. Plain Ruby in a recipe runs at compile time, so it cannot see the effects of resources that have not converged yet. Many "file not found" bugs come from that split.

5. How do you run only one recipe for a test without changing the node's run-list?

Use -o (override run-list). It replaces the run-list for that run only and does not save it.

sudo chef-client -o 'recipe[nginx::default]'

6. What is the difference between -o and -r?

-o overrides the run-list for one run. -r permanently replaces the node's run-list with the items you give.

7. How do you run Chef Infra Client without a Chef Infra Server?

Use local mode: chef-client -z (--local-mode). It starts an in-memory chef-zero and reads cookbooks, roles and data bags from the local repository. This is handy for reproducing a failure on a laptop.

8. How do you see when each node last ran successfully?

knife status prints the time since each node's last successful run. knife status --run-list adds run-lists, and knife status --hide-by-mins 60 lists only nodes that have not run successfully in the past hour.

9. How do you view a node's attributes from your workstation?

knife node show NODE -l prints all attributes. knife node show NODE -a ATTRIBUTE prints one, which is quicker when you suspect a single value.

10. What does "idempotent" mean, and how does it help you spot bugs?

Running the same code again on a converged node should change nothing. If a second run still reports updated resources, something is not idempotent, such as an execute resource without a guard.

11. What are guards?

not_if and only_if properties decide whether a resource runs. Missing or wrong guards are a common cause of resources that run on every converge.

12. What tool checks cookbook style before you push?

Cookstyle, a linter built on RuboCop with cops tuned for Chef code. cookstyle -a auto-corrects the safe cases.

13. What is Ohai and why would you check it while debugging?

Ohai collects automatic attributes such as platform, IP addresses and memory at the start of each run. If a recipe branches on node['platform'] and does the wrong thing, check what Ohai actually reported with the ohai command.

14. A run fails with an SSL certificate error. Which knife commands help?

knife ssl check verifies the server certificate, and knife ssl fetch downloads it into the trusted certificates directory. Fetch only from a server you trust.

15. What is chef-shell?

An interactive Ruby (IRb) session that can load recipes and attributes. It has standalone, solo and client modes, and with the breakpoint resource you can pause a run and step through it.

Questions for 2 to 5 years of experience

16. A service restarts on every run. How do you find the cause?

Look for a resource that reports "updated" on every run and notifies the service. Typical culprits: a template whose content changes each time (a timestamp or unsorted hash in it), an execute without a guard, or a remote_file without a checksum.

17. A value in a recipe is not what the role set. Why?

Attribute precedence. Chef has default, force_default, normal, override, force_override and automatic levels, set from cookbooks, roles, environments and Ohai. A cookbook force_override beats a role override, and automatic attributes beat everything.

18. How do you find where an attribute value came from?

In chef-shell, debug_value shows the precedence level and location that set each value. On the workstation, compare knife node show -a with the role and environment files.

19. Why can normal attributes cause stale values?

Normal attributes persist on the node object between runs. If a recipe once set node.normal, the value stays after you remove the code. You must delete it explicitly or use default and override levels instead.

20. A notification fires at the wrong time. What do you check?

The timer. :delayed (the default) queues the action to the end of the run, :immediately runs it straight away, and :before runs it before the notifying resource. Also check that the notified resource name matches exactly.

21. A recipe reads a file that another resource creates, and it fails. Why?

The read happens in plain Ruby at compile time, before the creating resource converges. Move the read into a lazy property (lazy { ... }), a ruby_block, or a custom resource action.

22. What is unified mode and how does it change debugging?

Unified mode compiles and converges a custom resource's action block in one pass, in the order written. Resources run as soon as they are declared, so order-of-operations bugs inside custom resources become easier to follow.

23. A node is converging with an old cookbook version. What do you check with Policyfiles?

Check which policy group the node belongs to and which revision of Policyfile.lock.json was pushed there. chef diff compares lock revisions, and chef push GROUP uploads a new one.

24. And with roles and environments?

Check the environment's cookbook_versions constraints. A pin such as = 2.1.0 holds the node back even after a newer version is uploaded.

25. A Test Kitchen converge passes but verify fails. What next?

Run kitchen login to open a shell on the instance and inspect it by hand. The converge succeeded, so the gap is between what the recipe did and what the InSpec tests expect.

26. Which Kitchen commands do you use in a debug loop?

kitchen converge to apply, kitchen verify to test, kitchen login to inspect, kitchen destroy to clean up, and kitchen test for the full cycle. kitchen diagnose prints the computed configuration.

27. A package resource fails on one distribution only. How do you approach it?

Check the package name on that platform, the repository configuration and the Ohai platform values. Add a Kitchen platform for that distribution so the failure is reproducible.

28. What does ignore_failure true do, and why be careful?

It lets the run continue when that resource fails. It is useful for temporary diagnosis but hides real errors if left in place.

29. How do you use handlers when troubleshooting?

Exception and report handlers run at the end of a run. An exception handler can send failures to chat or a ticket system with the failed resource and backtrace, so you notice failures that nobody watches in the console.

30. A data bag item cannot be read on a node. What do you check?

That the item exists on the server (knife data bag show BAG ITEM), that the node's client has read permission, and for encrypted items, that the node has the right secret file.

31. Why might search return nothing in a recipe?

The target nodes have not completed a run yet so their attributes are not indexed, the query syntax is wrong, or the search is scoped to a different environment or policy group.

32. What does a "Cookbook not found" error during dependency resolution mean?

A dependency in metadata.rb or the Policyfile cannot be satisfied: the cookbook was never uploaded, the version constraint is too tight, or the source (Supermarket, Git, local path) is unreachable.

33. Runs hang until the lock times out. Why?

Another Chef run is already active on the node, often a scheduled one. Chef uses a run lock, and --run-lock-timeout controls how long a new run waits.

34. A Windows recipe fails only when run as a scheduled task. What do you suspect?

The account context. The scheduled task may run as SYSTEM with different environment variables, network access and drive mappings than your interactive session.

35. How do you stop a broken cookbook reaching all nodes while you debug?

With Policyfiles, do not push the new revision to production groups. With environments, keep the version pin. In both cases revert in Git and push the last known good version.

Questions for senior engineers

36. 300 nodes stopped reporting overnight. How do you triage?

Group the failing nodes by what they share: same policy group, same cookbook version, same network zone or same OS. knife status --hide-by-mins gives the list. Then read one stack trace from each group instead of all 300.

37. Nodes fail with 401 Unauthorized. What are the usual causes?

A missing or invalid client.pem, a node name that does not match the registered client, or a clock that has drifted more than 15 minutes. The Chef docs list clock sync as a named fix for 401 errors.

38. And 403 Forbidden?

The client is authenticated but lacks permission (read, update, delete) on the object it tried to use, often a node or data bag. Fix the ACL or group membership.

39. How do you approach a 500 error from Chef Infra Server?

It is a server-side failure, so read the server logs rather than the client output. Check backend services and disk space on the server.

40. How do you plan an upgrade from Chef Infra Client 18 to 19?

Version 19 moved from Omnibus to Habitat packaging and ships a migration tool for in-place upgrades and side-by-side installs. Test on a canary group, run your Kitchen suites against 19, and check the release notes' known issues (for example, the upgrade path notes for RPM and DEB systems) before rolling out.

41. How do you design cookbooks so failures are easier to diagnose?

Small single-purpose cookbooks, custom resources with clear properties, no compile-time side effects, and a Kitchen suite per supported platform.

42. What metrics show fleet health?

Run success rate, time since last successful run per node, run duration and the number of updated resources per run. A rising updated-resource count on a stable fleet points to non-idempotent code. Chef Automate shows these if you use it.

43. How do you make rollouts safer?

Promote Policyfile revisions through policy groups (for example dev, staging, prod), use a canary group in each tier, and gate promotion on run success rate.

44. Runs became much slower after a change. How do you find out why?

Compare run durations before and after. --profile-ruby dumps a profiling graph to the cache directory, though Chef says not to use it in production. Common causes are heavy searches, large remote files and many package resources each calling the package manager.

45. How do you keep secrets out of logs while debugging?

Mark resource properties as sensitive (sensitive true), avoid printing node attributes that hold secrets, and fetch secrets at converge time from a secrets manager or encrypted data bag.

46. How do you decide whether a fix belongs in the cookbook or the node data?

If every node needs it, it belongs in the cookbook with a test. If one node or group differs, use policy attributes or environment data, and document why.

47. How do you debug a Chef run that misbehaves only in production?

Run why-run on one production node, compare its attributes and policy revision with staging, and look at data that exists only in production: data bag items, search results and network access.

Scenario questions

48. Scenario: the run fails with "No such file or directory" on a template source.

The template file is missing from templates/, or the source name or cookbook property points somewhere else. Check the uploaded cookbook contents with knife cookbook show.

49. Scenario: service[nginx] fails to start after a template change.

The new config is invalid. Add a verify property to the template (for example nginx -t -c %{path}) so bad config never lands, then check the service logs on the node.

50. Scenario: a new node fails its first run with 401 using the validator.

The validator key on the node does not match the organization, the organization name in the URL is wrong, or the clock is off. Re-bootstrap with knife bootstrap after fixing the cause.

51. Scenario: a node changes a file back every run because another tool edits it.

Two tools manage the same file. Decide which one owns it. If Chef should own it, remove the other edit. If not, remove the resource from Chef.

52. Scenario: an attribute change in a role does nothing.

A higher-precedence value overrides it, most often a force_override in a cookbook, a stale normal attribute, or the node uses a Policyfile, which does not use roles in the same way.

53. Scenario: after a cookbook bump, Kitchen passes but production fails.

Kitchen tested a different platform version, different attributes or no real data bags. Add a suite that matches the production platform and use test fixtures for data.

54. Scenario: a bash resource exits 0 but did nothing.

The script ran from a different working directory or user than expected. Set cwd, user and environment explicitly and add a guard that checks the result.

55. Scenario: half the web nodes have the wrong load balancer member list.

The recipe builds the list with search, and some members had not finished a run when others searched. Expect eventual consistency or move the member list to explicit data.

56. Scenario: a run on Windows fails installing an MSI.

Check the MSI log, the installer's exit code and whether a reboot is pending. Use the reboot resource to handle required restarts.

57. Scenario: an engineer ran chef-client -r on a production node to test something.

The node's run-list was permanently replaced. Restore it from source control or the server history, and teach the team to use -o for one-off runs.

58. Scenario: chef-client fails to load a gem used by a custom resource.

Declare the gem in metadata.rb with the gem keyword so Chef installs it before compile, and check proxy settings if the install times out.

59. Scenario: a Policyfile push succeeded but nodes still run the old code.

Nodes pick up the new revision on their next run, so check the interval. Also confirm the nodes' policy_group and policy_name match what you pushed.

60. Scenario: InSpec reports a control failing that the cookbook should have fixed.

Either the recipe never ran (check the run-list or policy) or the control checks a different setting. Read both side by side before changing either.

61. Scenario: disk space on nodes fills up in /var/chef/cache.

remote_file downloads and backups pile up. Clean old artifacts in the cookbook and limit file backups with the backup property.

62. Scenario: you are asked whether to keep Chef or move to another tool.

Answer with facts: how many cookbooks, who maintains them, test coverage, and whether Chef Infra Client 19 meets your platform needs. Compare against what Ansible would cost to adopt; our Ansible interview guide covers that side.

Debug commands at a glance

GoalCommand
Verbose runchef-client -l debug
Preview changeschef-client -W
One-off run-listchef-client -o 'recipe[x]'
Single run, no intervalchef-client --once
No serverchef-client -z
Last run per nodeknife status --run-list
Node attributesknife node show NODE -l
Certificate troubleknife ssl check
Compare policy revisionschef diff

Chef sits inside a wider infrastructure-as-code toolkit; see 12 infrastructure as code tools ranked. For practice across tools, our DevOps training in Pune runs in the Kharadi classroom and live online, and the DevOps interview questions hub links every topic.

FAQ

Where is the Chef stack trace file?

By default at /var/chef/cache/chef-stacktrace.out on Linux and C:\chef\cache\chef-stacktrace.out on Windows.

Does why-run mode guarantee what will happen?

No. It reports what would change but makes assumptions when a resource depends on earlier changes, so test in a real environment too.

What is the current Chef Infra Client version line?

Chef Infra Client 19, released in February 2026 as the long-term support version and packaged with Chef Habitat.

Why does Chef return 401 Unauthorized?

Usually a bad or missing client key, a node name mismatch, or a clock more than 15 minutes off.

How do I run one recipe without changing the run-list?

Use chef-client -o 'recipe[cookbook::recipe]'.

How is this list different from other Chef question lists?

It covers debugging failed runs. For definitions and basics, use the 45 most asked Chef questions guide.

References

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Angry Angry 0
Sad Sad 0
Wow Wow 0
Mridul I am a passionate technology enthusiast with a strong focus on DevOps, Cloud Computing, and Cybersecurity. Through my blogs at DevOps Training Institute, I aim to simplify complex concepts and share practical insights for learners and professionals. My goal is to empower readers with knowledge, hands-on tips, and industry best practices to stay ahead in the ever-evolving world of DevOps.