[SOLVED]Resource busy when saving a new automations

Hello everyone,

Still new to HA, I’m trying to add some automations to my setup from the GUI but fails everytime and I cannot figure out why…

The automation is quite simple : send a notification to my phone everytime my door sensor changes state.

When I hit the save button HA shows a 500 error.

Server logs looks like this :

homeassistant  | 2025-07-05T08:35:43.614163981Z 2025-07-05 10:35:43.604 ERROR (SyncWorker_4) [homeassistant.util.file] Saving file failed: /config/automations.yaml
homeassistant  | 2025-07-05T08:35:43.614273775Z Traceback (most recent call last):
homeassistant  | 2025-07-05T08:35:43.614307849Z   File "/usr/src/homeassistant/homeassistant/util/file.py", line 36, in write_utf8_file_atomic
homeassistant  | 2025-07-05T08:35:43.614339163Z     with AtomicWriter(filename, mode=mode, overwrite=True).open() as fdesc:
homeassistant  | 2025-07-05T08:35:43.614367847Z          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
homeassistant  | 2025-07-05T08:35:43.614394828Z   File "/usr/local/lib/python3.13/contextlib.py", line 148, in __exit__
homeassistant  | 2025-07-05T08:35:43.614422180Z     next(self.gen)
homeassistant  | 2025-07-05T08:35:43.614449105Z     ~~~~^^^^^^^^^^
homeassistant  | 2025-07-05T08:35:43.614523215Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 172, in _open
homeassistant  | 2025-07-05T08:35:43.614545289Z     self.commit(f)
homeassistant  | 2025-07-05T08:35:43.614561066Z     ~~~~~~~~~~~^^^
homeassistant  | 2025-07-05T08:35:43.614576714Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 205, in commit
homeassistant  | 2025-07-05T08:35:43.614593621Z     replace_atomic(f.name, self._path)
homeassistant  | 2025-07-05T08:35:43.614609510Z     ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:35:43.614625361Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 99, in replace_atomic
homeassistant  | 2025-07-05T08:35:43.614643065Z     return _replace_atomic(src, dst)
homeassistant  | 2025-07-05T08:35:43.614658675Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 55, in _replace_atomic
homeassistant  | 2025-07-05T08:35:43.614675416Z     os.rename(src, dst)
homeassistant  | 2025-07-05T08:35:43.614690527Z     ~~~~~~~~~^^^^^^^^^^
homeassistant  | 2025-07-05T08:35:43.614705749Z OSError: [Errno 16] Resource busy: '/config/tmp0a9w5j8t' -> '/config/automations.yaml'
homeassistant  | 2025-07-05T08:35:43.639838054Z 2025-07-05 10:35:43.615 ERROR (MainThread) [aiohttp.server] Error handling request from 82.65.149.132
homeassistant  | 2025-07-05T08:35:43.639947607Z Traceback (most recent call last):
homeassistant  | 2025-07-05T08:35:43.639974422Z   File "/usr/src/homeassistant/homeassistant/util/file.py", line 36, in write_utf8_file_atomic
homeassistant  | 2025-07-05T08:35:43.639994514Z     with AtomicWriter(filename, mode=mode, overwrite=True).open() as fdesc:
homeassistant  | 2025-07-05T08:35:43.640012940Z          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
homeassistant  | 2025-07-05T08:35:43.640030106Z   File "/usr/local/lib/python3.13/contextlib.py", line 148, in __exit__
homeassistant  | 2025-07-05T08:35:43.640047180Z     next(self.gen)
homeassistant  | 2025-07-05T08:35:43.640062976Z     ~~~~^^^^^^^^^^
homeassistant  | 2025-07-05T08:35:43.640078568Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 172, in _open
homeassistant  | 2025-07-05T08:35:43.640095679Z     self.commit(f)
homeassistant  | 2025-07-05T08:35:43.640111382Z     ~~~~~~~~~~~^^^
homeassistant  | 2025-07-05T08:35:43.640126956Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 205, in commit
homeassistant  | 2025-07-05T08:35:43.640143530Z     replace_atomic(f.name, self._path)
homeassistant  | 2025-07-05T08:35:43.640158641Z     ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:35:43.640174363Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 99, in replace_atomic
homeassistant  | 2025-07-05T08:35:43.640190881Z     return _replace_atomic(src, dst)
homeassistant  | 2025-07-05T08:35:43.640206455Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 55, in _replace_atomic
homeassistant  | 2025-07-05T08:35:43.640223732Z     os.rename(src, dst)
homeassistant  | 2025-07-05T08:35:43.640239010Z     ~~~~~~~~~^^^^^^^^^^
homeassistant  | 2025-07-05T08:35:43.640254139Z OSError: [Errno 16] Resource busy: '/config/tmp0a9w5j8t' -> '/config/automations.yaml'
homeassistant  | 2025-07-05T08:35:43.640299786Z
homeassistant  | 2025-07-05T08:35:43.640318656Z The above exception was the direct cause of the following exception:
homeassistant  | 2025-07-05T08:35:43.640335100Z
homeassistant  | 2025-07-05T08:35:43.640350452Z Traceback (most recent call last):
homeassistant  | 2025-07-05T08:35:43.640365970Z   File "/usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py", line 510, in _handle_request
homeassistant  | 2025-07-05T08:35:43.640382711Z     resp = await request_handler(request)
homeassistant  | 2025-07-05T08:35:43.640398488Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:35:43.640414303Z   File "/usr/local/lib/python3.13/site-packages/aiohttp/web_app.py", line 569, in _handle
homeassistant  | 2025-07-05T08:35:43.640430988Z     return await handler(request)
homeassistant  | 2025-07-05T08:35:43.640446395Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:35:43.640461820Z   File "/usr/local/lib/python3.13/site-packages/aiohttp/web_middlewares.py", line 117, in impl
homeassistant  | 2025-07-05T08:35:43.640478783Z     return await handler(request)
homeassistant  | 2025-07-05T08:35:43.640494338Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:35:43.640509968Z   File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
homeassistant  | 2025-07-05T08:35:43.640528004Z     return await handler(request)
homeassistant  | 2025-07-05T08:35:43.640543560Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:35:43.640568467Z   File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 210, in forwarded_middleware
homeassistant  | 2025-07-05T08:35:43.640587170Z     return await handler(request)
homeassistant  | 2025-07-05T08:35:43.640602892Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:35:43.640618540Z   File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
homeassistant  | 2025-07-05T08:35:43.640635595Z     return await handler(request)
homeassistant  | 2025-07-05T08:35:43.640650724Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:35:43.640666354Z   File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
homeassistant  | 2025-07-05T08:35:43.640683224Z     return await handler(request)
homeassistant  | 2025-07-05T08:35:43.640698520Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:35:43.640714131Z   File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
homeassistant  | 2025-07-05T08:35:43.640885794Z     return await handler(request)
homeassistant  | 2025-07-05T08:35:43.640952386Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:35:43.640972663Z   File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 41, in headers_middleware
homeassistant  | 2025-07-05T08:35:43.640992366Z     response = await handler(request)
homeassistant  | 2025-07-05T08:35:43.641008310Z                ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:35:43.641024606Z   File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
homeassistant  | 2025-07-05T08:35:43.641746390Z     result = await handler(request, **request.match_info)
homeassistant  | 2025-07-05T08:35:43.641771686Z              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:35:43.641789056Z   File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 83, in with_admin
homeassistant  | 2025-07-05T08:35:43.641806277Z     return await func(self, request, *args, **kwargs)
homeassistant  | 2025-07-05T08:35:43.641822222Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:35:43.641840962Z   File "/usr/src/homeassistant/homeassistant/components/config/view.py", line 134, in post
homeassistant  | 2025-07-05T08:35:43.641858147Z     await hass.async_add_executor_job(_write, path, current)
homeassistant  | 2025-07-05T08:35:43.641874443Z   File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
homeassistant  | 2025-07-05T08:35:43.641891054Z     result = self.fn(*self.args, **self.kwargs)
homeassistant  | 2025-07-05T08:35:43.641908294Z   File "/usr/src/homeassistant/homeassistant/components/config/view.py", line 251, in _write
homeassistant  | 2025-07-05T08:35:43.641925109Z     write_utf8_file_atomic(path, contents)
homeassistant  | 2025-07-05T08:35:43.641941164Z     ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:35:43.641956812Z   File "/usr/src/homeassistant/homeassistant/util/file.py", line 42, in write_utf8_file_atomic
homeassistant  | 2025-07-05T08:35:43.641973774Z     raise WriteError(error) from error
homeassistant  | 2025-07-05T08:35:43.641989589Z homeassistant.util.file.WriteError: [Errno 16] Resource busy: '/config/tmp0a9w5j8t' -> '/config/automations.yaml'
homeassistant  | 2025-07-05T08:37:09.321988661Z 2025-07-05 10:37:09.314 ERROR (SyncWorker_3) [homeassistant.util.file] Saving file failed: /config/automations.yaml
homeassistant  | 2025-07-05T08:37:09.322166917Z Traceback (most recent call last):
homeassistant  | 2025-07-05T08:37:09.322207805Z   File "/usr/src/homeassistant/homeassistant/util/file.py", line 36, in write_utf8_file_atomic
homeassistant  | 2025-07-05T08:37:09.322242842Z     with AtomicWriter(filename, mode=mode, overwrite=True).open() as fdesc:
homeassistant  | 2025-07-05T08:37:09.322275619Z          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
homeassistant  | 2025-07-05T08:37:09.322311192Z   File "/usr/local/lib/python3.13/contextlib.py", line 148, in __exit__
homeassistant  | 2025-07-05T08:37:09.322344414Z     next(self.gen)
homeassistant  | 2025-07-05T08:37:09.322376043Z     ~~~~^^^^^^^^^^
homeassistant  | 2025-07-05T08:37:09.322405950Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 172, in _open
homeassistant  | 2025-07-05T08:37:09.322437857Z     self.commit(f)
homeassistant  | 2025-07-05T08:37:09.322467949Z     ~~~~~~~~~~~^^^
homeassistant  | 2025-07-05T08:37:09.322498467Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 205, in commit
homeassistant  | 2025-07-05T08:37:09.322531318Z     replace_atomic(f.name, self._path)
homeassistant  | 2025-07-05T08:37:09.322562743Z     ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:37:09.322593187Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 99, in replace_atomic
homeassistant  | 2025-07-05T08:37:09.322716352Z     return _replace_atomic(src, dst)
homeassistant  | 2025-07-05T08:37:09.322910367Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 55, in _replace_atomic
homeassistant  | 2025-07-05T08:37:09.323090215Z     os.rename(src, dst)
homeassistant  | 2025-07-05T08:37:09.323117400Z     ~~~~~~~~~^^^^^^^^^^
homeassistant  | 2025-07-05T08:37:09.323212028Z OSError: [Errno 16] Resource busy: '/config/tmpmmm_1dzs' -> '/config/automations.yaml'
homeassistant  | 2025-07-05T08:37:09.339523808Z 2025-07-05 10:37:09.322 ERROR (MainThread) [aiohttp.server] Error handling request from 82.65.149.132
homeassistant  | 2025-07-05T08:37:09.339626232Z Traceback (most recent call last):
homeassistant  | 2025-07-05T08:37:09.339645473Z   File "/usr/src/homeassistant/homeassistant/util/file.py", line 36, in write_utf8_file_atomic
homeassistant  | 2025-07-05T08:37:09.339661250Z     with AtomicWriter(filename, mode=mode, overwrite=True).open() as fdesc:
homeassistant  | 2025-07-05T08:37:09.339675713Z          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
homeassistant  | 2025-07-05T08:37:09.339690083Z   File "/usr/local/lib/python3.13/contextlib.py", line 148, in __exit__
homeassistant  | 2025-07-05T08:37:09.339704675Z     next(self.gen)
homeassistant  | 2025-07-05T08:37:09.339718045Z     ~~~~^^^^^^^^^^
homeassistant  | 2025-07-05T08:37:09.339732434Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 172, in _open
homeassistant  | 2025-07-05T08:37:09.339747304Z     self.commit(f)
homeassistant  | 2025-07-05T08:37:09.339760933Z     ~~~~~~~~~~~^^^
homeassistant  | 2025-07-05T08:37:09.339774507Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 205, in commit
homeassistant  | 2025-07-05T08:37:09.339789192Z     replace_atomic(f.name, self._path)
homeassistant  | 2025-07-05T08:37:09.339802951Z     ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:37:09.339816821Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 99, in replace_atomic
homeassistant  | 2025-07-05T08:37:09.339831488Z     return _replace_atomic(src, dst)
homeassistant  | 2025-07-05T08:37:09.339845395Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 55, in _replace_atomic
homeassistant  | 2025-07-05T08:37:09.339860320Z     os.rename(src, dst)
homeassistant  | 2025-07-05T08:37:09.339873765Z     ~~~~~~~~~^^^^^^^^^^
homeassistant  | 2025-07-05T08:37:09.339887190Z OSError: [Errno 16] Resource busy: '/config/tmpmmm_1dzs' -> '/config/automations.yaml'
homeassistant  | 2025-07-05T08:37:09.339902023Z
homeassistant  | 2025-07-05T08:37:09.339915542Z The above exception was the direct cause of the following exception:
homeassistant  | 2025-07-05T08:37:09.339930023Z
homeassistant  | 2025-07-05T08:37:09.339943134Z Traceback (most recent call last):
homeassistant  | 2025-07-05T08:37:09.339957356Z   File "/usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py", line 510, in _handle_request
homeassistant  | 2025-07-05T08:37:09.339972337Z     resp = await request_handler(request)
homeassistant  | 2025-07-05T08:37:09.339986503Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:37:09.340000911Z   File "/usr/local/lib/python3.13/site-packages/aiohttp/web_app.py", line 569, in _handle
homeassistant  | 2025-07-05T08:37:09.340056854Z     return await handler(request)
homeassistant  | 2025-07-05T08:37:09.340076076Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:37:09.340090427Z   File "/usr/local/lib/python3.13/site-packages/aiohttp/web_middlewares.py", line 117, in impl
homeassistant  | 2025-07-05T08:37:09.340105223Z     return await handler(request)
homeassistant  | 2025-07-05T08:37:09.340120371Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:37:09.340134038Z   File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
homeassistant  | 2025-07-05T08:37:09.340149093Z     return await handler(request)
homeassistant  | 2025-07-05T08:37:09.340162834Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:37:09.340186037Z   File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 210, in forwarded_middleware
homeassistant  | 2025-07-05T08:37:09.340204074Z     return await handler(request)
homeassistant  | 2025-07-05T08:37:09.340218721Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:37:09.340233017Z   File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
homeassistant  | 2025-07-05T08:37:09.340249091Z     return await handler(request)
homeassistant  | 2025-07-05T08:37:09.340263258Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:37:09.340277591Z   File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
homeassistant  | 2025-07-05T08:37:09.340293257Z     return await handler(request)
homeassistant  | 2025-07-05T08:37:09.340307405Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:37:09.340321590Z   File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
homeassistant  | 2025-07-05T08:37:09.340336534Z     return await handler(request)
homeassistant  | 2025-07-05T08:37:09.340350460Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:37:09.340364682Z   File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 41, in headers_middleware
homeassistant  | 2025-07-05T08:37:09.340379774Z     response = await handler(request)
homeassistant  | 2025-07-05T08:37:09.340393496Z                ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:37:09.340407440Z   File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
homeassistant  | 2025-07-05T08:37:09.340422347Z     result = await handler(request, **request.match_info)
homeassistant  | 2025-07-05T08:37:09.340436366Z              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:37:09.340450532Z   File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 83, in with_admin
homeassistant  | 2025-07-05T08:37:09.340465347Z     return await func(self, request, *args, **kwargs)
homeassistant  | 2025-07-05T08:37:09.340479476Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:37:09.340493791Z   File "/usr/src/homeassistant/homeassistant/components/config/view.py", line 134, in post
homeassistant  | 2025-07-05T08:37:09.340508994Z     await hass.async_add_executor_job(_write, path, current)
homeassistant  | 2025-07-05T08:37:09.340557123Z   File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
homeassistant  | 2025-07-05T08:37:09.340578141Z     result = self.fn(*self.args, **self.kwargs)
homeassistant  | 2025-07-05T08:37:09.340592530Z   File "/usr/src/homeassistant/homeassistant/components/config/view.py", line 251, in _write
homeassistant  | 2025-07-05T08:37:09.340607270Z     write_utf8_file_atomic(path, contents)
homeassistant  | 2025-07-05T08:37:09.340621251Z     ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:37:09.340636806Z   File "/usr/src/homeassistant/homeassistant/util/file.py", line 42, in write_utf8_file_atomic
homeassistant  | 2025-07-05T08:37:09.340652214Z     raise WriteError(error) from error
homeassistant  | 2025-07-05T08:37:09.340666380Z homeassistant.util.file.WriteError: [Errno 16] Resource busy: '/config/tmpmmm_1dzs' -> '/config/automations.yaml'
homeassistant  | 2025-07-05T08:38:34.714960948Z 2025-07-05 10:38:34.707 ERROR (SyncWorker_3) [homeassistant.util.file] Saving file failed: /config/automations.yaml
homeassistant  | 2025-07-05T08:38:34.715051890Z Traceback (most recent call last):
homeassistant  | 2025-07-05T08:38:34.715149778Z   File "/usr/src/homeassistant/homeassistant/util/file.py", line 36, in write_utf8_file_atomic
homeassistant  | 2025-07-05T08:38:34.715182203Z     with AtomicWriter(filename, mode=mode, overwrite=True).open() as fdesc:
homeassistant  | 2025-07-05T08:38:34.715206073Z          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
homeassistant  | 2025-07-05T08:38:34.715227887Z   File "/usr/local/lib/python3.13/contextlib.py", line 148, in __exit__
homeassistant  | 2025-07-05T08:38:34.715249368Z     next(self.gen)
homeassistant  | 2025-07-05T08:38:34.715270498Z     ~~~~^^^^^^^^^^
homeassistant  | 2025-07-05T08:38:34.715290960Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 172, in _open
homeassistant  | 2025-07-05T08:38:34.715312775Z     self.commit(f)
homeassistant  | 2025-07-05T08:38:34.715332367Z     ~~~~~~~~~~~^^^
homeassistant  | 2025-07-05T08:38:34.715351922Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 205, in commit
homeassistant  | 2025-07-05T08:38:34.715373255Z     replace_atomic(f.name, self._path)
homeassistant  | 2025-07-05T08:38:34.715393273Z     ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:38:34.715412884Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 99, in replace_atomic
homeassistant  | 2025-07-05T08:38:34.715433772Z     return _replace_atomic(src, dst)
homeassistant  | 2025-07-05T08:38:34.715453754Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 55, in _replace_atomic
homeassistant  | 2025-07-05T08:38:34.715474364Z     os.rename(src, dst)
homeassistant  | 2025-07-05T08:38:34.715493697Z     ~~~~~~~~~^^^^^^^^^^
homeassistant  | 2025-07-05T08:38:34.715513197Z OSError: [Errno 16] Resource busy: '/config/tmp5tkjzs6j' -> '/config/automations.yaml'
homeassistant  | 2025-07-05T08:38:34.736178010Z 2025-07-05 10:38:34.715 ERROR (MainThread) [aiohttp.server] Error handling request from 82.65.149.132
homeassistant  | 2025-07-05T08:38:34.736269138Z Traceback (most recent call last):
homeassistant  | 2025-07-05T08:38:34.736294638Z   File "/usr/src/homeassistant/homeassistant/util/file.py", line 36, in write_utf8_file_atomic
homeassistant  | 2025-07-05T08:38:34.736338915Z     with AtomicWriter(filename, mode=mode, overwrite=True).open() as fdesc:
homeassistant  | 2025-07-05T08:38:34.736355526Z          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
homeassistant  | 2025-07-05T08:38:34.736368544Z   File "/usr/local/lib/python3.13/contextlib.py", line 148, in __exit__
homeassistant  | 2025-07-05T08:38:34.736381581Z     next(self.gen)
homeassistant  | 2025-07-05T08:38:34.736394414Z     ~~~~^^^^^^^^^^
homeassistant  | 2025-07-05T08:38:34.736406969Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 172, in _open
homeassistant  | 2025-07-05T08:38:34.736420654Z     self.commit(f)
homeassistant  | 2025-07-05T08:38:34.736432950Z     ~~~~~~~~~~~^^^
homeassistant  | 2025-07-05T08:38:34.736445172Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 205, in commit
homeassistant  | 2025-07-05T08:38:34.736458302Z     replace_atomic(f.name, self._path)
homeassistant  | 2025-07-05T08:38:34.736470227Z     ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:38:34.736482468Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 99, in replace_atomic
homeassistant  | 2025-07-05T08:38:34.736496060Z     return _replace_atomic(src, dst)
homeassistant  | 2025-07-05T08:38:34.736508375Z   File "/usr/local/lib/python3.13/site-packages/atomicwrites/__init__.py", line 55, in _replace_atomic
homeassistant  | 2025-07-05T08:38:34.736521560Z     os.rename(src, dst)
homeassistant  | 2025-07-05T08:38:34.736533356Z     ~~~~~~~~~^^^^^^^^^^
homeassistant  | 2025-07-05T08:38:34.736545374Z OSError: [Errno 16] Resource busy: '/config/tmp5tkjzs6j' -> '/config/automations.yaml'
homeassistant  | 2025-07-05T08:38:34.736558244Z
homeassistant  | 2025-07-05T08:38:34.736569911Z The above exception was the direct cause of the following exception:
homeassistant  | 2025-07-05T08:38:34.736582559Z
homeassistant  | 2025-07-05T08:38:34.736594188Z Traceback (most recent call last):
homeassistant  | 2025-07-05T08:38:34.736606799Z   File "/usr/local/lib/python3.13/site-packages/aiohttp/web_protocol.py", line 510, in _handle_request
homeassistant  | 2025-07-05T08:38:34.736619836Z     resp = await request_handler(request)
homeassistant  | 2025-07-05T08:38:34.736631854Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:38:34.736643780Z   File "/usr/local/lib/python3.13/site-packages/aiohttp/web_app.py", line 569, in _handle
homeassistant  | 2025-07-05T08:38:34.736656520Z     return await handler(request)
homeassistant  | 2025-07-05T08:38:34.736668242Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:38:34.736680187Z   File "/usr/local/lib/python3.13/site-packages/aiohttp/web_middlewares.py", line 117, in impl
homeassistant  | 2025-07-05T08:38:34.736693409Z     return await handler(request)
homeassistant  | 2025-07-05T08:38:34.736705242Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:38:34.736717204Z   File "/usr/src/homeassistant/homeassistant/components/http/security_filter.py", line 92, in security_filter_middleware
homeassistant  | 2025-07-05T08:38:34.736730926Z     return await handler(request)
homeassistant  | 2025-07-05T08:38:34.736749204Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:38:34.736789499Z   File "/usr/src/homeassistant/homeassistant/components/http/forwarded.py", line 210, in forwarded_middleware
homeassistant  | 2025-07-05T08:38:34.736806907Z     return await handler(request)
homeassistant  | 2025-07-05T08:38:34.736878961Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:38:34.736894961Z   File "/usr/src/homeassistant/homeassistant/components/http/request_context.py", line 26, in request_context_middleware
homeassistant  | 2025-07-05T08:38:34.736908868Z     return await handler(request)
homeassistant  | 2025-07-05T08:38:34.736921256Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:38:34.736933478Z   File "/usr/src/homeassistant/homeassistant/components/http/ban.py", line 86, in ban_middleware
homeassistant  | 2025-07-05T08:38:34.736946756Z     return await handler(request)
homeassistant  | 2025-07-05T08:38:34.736958959Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:38:34.736971052Z   File "/usr/src/homeassistant/homeassistant/components/http/auth.py", line 242, in auth_middleware
homeassistant  | 2025-07-05T08:38:34.736984348Z     return await handler(request)
homeassistant  | 2025-07-05T08:38:34.736997014Z            ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:38:34.737009421Z   File "/usr/src/homeassistant/homeassistant/components/http/headers.py", line 41, in headers_middleware
homeassistant  | 2025-07-05T08:38:34.737023032Z     response = await handler(request)
homeassistant  | 2025-07-05T08:38:34.737035310Z                ^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:38:34.737047717Z   File "/usr/src/homeassistant/homeassistant/helpers/http.py", line 73, in handle
homeassistant  | 2025-07-05T08:38:34.737060902Z     result = await handler(request, **request.match_info)
homeassistant  | 2025-07-05T08:38:34.737073680Z              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:38:34.737086087Z   File "/usr/src/homeassistant/homeassistant/components/http/decorators.py", line 83, in with_admin
homeassistant  | 2025-07-05T08:38:34.737099494Z     return await func(self, request, *args, **kwargs)
homeassistant  | 2025-07-05T08:38:34.737111716Z            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:38:34.737123956Z   File "/usr/src/homeassistant/homeassistant/components/config/view.py", line 134, in post
homeassistant  | 2025-07-05T08:38:34.737136864Z     await hass.async_add_executor_job(_write, path, current)
homeassistant  | 2025-07-05T08:38:34.737149141Z   File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
homeassistant  | 2025-07-05T08:38:34.737162067Z     result = self.fn(*self.args, **self.kwargs)
homeassistant  | 2025-07-05T08:38:34.737174418Z   File "/usr/src/homeassistant/homeassistant/components/config/view.py", line 251, in _write
homeassistant  | 2025-07-05T08:38:34.737187770Z     write_utf8_file_atomic(path, contents)
homeassistant  | 2025-07-05T08:38:34.737200085Z     ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^
homeassistant  | 2025-07-05T08:38:34.737212381Z   File "/usr/src/homeassistant/homeassistant/util/file.py", line 42, in write_utf8_file_atomic
homeassistant  | 2025-07-05T08:38:34.737225566Z     raise WriteError(error) from error
homeassistant  | 2025-07-05T08:38:34.737237677Z homeassistant.util.file.WriteError: [Errno 16] Resource busy: '/config/tmp5tkjzs6j' -> '/config/automations.yaml'

I’ve checked my yaml config under developer settings and HA says everything is fine, I’ve plenty of space on my config folder.
I’ve even given 777 permision to the file to rule out any rights error.

My configuration.yaml does include :

automation: !include automations.yaml

My automations.yaml is empty.

Reboot the HA box and try again.

Already rebooted the container and the host.
Still no luck :frowning:

How are you running HA? Are you able to delete automations.yaml?

Running in docker.
Tried to delete the file. It wasn’t recreated upon reboot and I got the same error.

Maybe show your docker compose file, or your docker run command

My HA section from docker-compose file :

  homeassistant:
    hostname: homeassistant
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - ./homeassistant/config/configuration.yaml:/config/configuration.yaml
      - ./homeassistant/config/automations.yaml:/config/automations.yaml
      - ./homeassistant/config/scenes.yaml:/config/scenes.yaml
      - ./homeassistant/config/scripts.yaml:/config/scripts.yaml
      - ./homeassistant/config/secrets.yaml:/config/secrets.yaml
      - ./homeassistant/config/custom_components:/config/custom_components
      - ./homeassistant/config/.storage:/config/.storage
      - /etc/localtime:/etc/localtime:ro
      - /run/dbus:/run/dbus:ro
      - ./homeassistant/run:/etc/services.d/home-assistant/run:ro
      - /var/log/homeassistant:/var/log
    ports:
      - 8123:8123
    restart: always
    extra_hosts:
      - "host.docker.internal:host-gateway"
    privileged: true
    networks:
      - backend
    environment:
      DISABLE_JEMALLOC: true

try with

homeassistant:
    hostname: homeassistant
    container_name: homeassistant
    image: "ghcr.io/home-assistant/home-assistant:stable"
    volumes:
      - ./homeassistant:/config
      - /etc/localtime:/etc/localtime:ro
      - /run/dbus:/run/dbus:ro
      - ./homeassistant/run:/etc/services.d/home-assistant/run:ro
      - /var/log/homeassistant:/var/log
    ports:
      - 8123:8123
    restart: always
    extra_hosts:
      - "host.docker.internal:host-gateway"
    privileged: true
    networks:
      - backend
    environment:
      DISABLE_JEMALLOC: true
2 Likes

Pointing to my docker file made me try with the folowing line commented :

#      - ./homeassistant/config/automations.yaml:/config/automations.yaml

It now works !
So I edited my docker-compose as you suggested to persist my configurations.

I don’t understand why HA can’t write to the file when it’s mounted through docker volumes as I can edit the file myself from the container but I guess mounting the config folder will be enough.

Thanks !