PyAirbyte makes temporary config files read-only, causing connector config migrations to fail with PermissionError
- Langage dominant
- Python
- Étoiles
- 22.1k
- Forks
- 5.3k
- Métriques de merge des PR
- Métriques de PR en attente
Description
### Connector Name
source-facebook-marketing
### Connector Version
6.0.2
### What step the error happened?
During the sync
### Relevant information
### What happened?
When using PyAirbyte with `airbyte-source-facebook-marketing` 6.0.2, `ab.get_source()` fails with
PermissionError: [Errno 13] Permission denied: '/var/folders/.../tmpxxxx.json'
The traceback originates from:
source.write_config(migrated_config, config_path)
inside the connector's config migration.
---
### Root cause
PyAirbyte creates temporary config files in
airbyte/_util/temp_files.py
and then changes their permissions to read-only:
```python
Path(temp_file.name).chmod(
stat.S_IRUSR |
stat.S_IRGRP |
stat.S_IROTH
)
which sets permissions to
0444
The Facebook Marketing connector performs an in-place config migration by rewriting the config:
source.write_config(migrated_config, config_path)
which internally executes
open(config_path, "w")
Since the config file is read-only, the connector fails with
PermissionError: [Errno 13] Permission denied
##FIX (suggested by chatGPT):
Changing the permissions to
Path(temp_file.name).chmod(0o644)
completely fixes the issue.
### Relevant log output
```shell
PermissionError: [Errno 13] Permission denied: '/var/folders/p_/rd8155fn7sb88l9wkyxr_cvr0000gn/T/tmpc2azmf0r.json'
2026-07-21 14:54:31 - ERROR - Something went wrong in the connector. See the logs for more details.
2026-07-21 14:54:31 - INFO - {"type":"TRACE","trace":{"type":"ERROR","emitted_at":1784625871518,"error":{"message":"Something went wrong in the connector. See the logs for more details.","internal_message":"[Errno 13] Permission denied: '/var/folders/p_/rd8155fn7sb88l9wkyxr_cvr0000gn/T/tmpc2azmf0r.json'","stack_trace":"Traceback (most recent call last):\n File \"/Users/apple/Code/neuroalchemy/neuro-ec2/app/dagster_pipelines/.venv/bin/source-facebook-marketing\", line 7, in \n sys.exit(run())\n ^^^^^\n File \"/Users/apple/Code/neuroalchemy/neuro-ec2/app/dagster_pipelines/.venv/lib/python3.11/site-packages/source_facebook_marketing/run.py\", line 26, in run\n MigrateDefaultActionBreakdowns.migrate(sys.argv[1:], source)\n File \"/Users/apple/Code/neuroalchemy/neuro-ec2/app/dagster_pipelines/.venv/lib/python3.11/site-packages/source_facebook_marketing/config_migrations.py\", line 276, in migrate\n emit_configuration_as_airbyte_control_message(cls.modify_and_save(config_path, source, config))\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/apple/Code/neuroalchemy/neuro-ec2/app/dagster_pipelines/.venv/lib/python3.11/site-packages/source_facebook_marketing/config_migrations.py\", line 262, in modify_and_save\n source.write_config(migrated_config, config_path)\n File \"/Users/apple/Code/neuroalchemy/neuro-ec2/app/dagster_pipelines/.venv/lib/python3.11/site-packages/airbyte_cdk/connector.py\", line 67, in write_config\n with open(config_path, \"w\") as fh:\n ^^^^^^^^^^^^^^^^^^^^^^\nPermissionError: [Errno 13] Permission denied: '/var/folders/p_/rd8155fn7sb88l9wkyxr_cvr0000gn/T/tmpc2azmf0r.json'\n","failure_type":"system_error"}}}
```
### Contribute
- [x] Yes, I want to contribute
---
**Internal Tracking:** https://github.com/airbytehq/oncall/issues/10891
Guide de contribution
Ouvrir le guide de contribution
Évaluation
Cette issue n'a pas encore été évaluée.