Jump to solution
Verify

The Fix

pip install celery==4.4.0rc5

Based on closed celery/celery issue #6306 · PR/commit linked

Production note: This usually shows up under retries/timeouts. Treat it as a side-effect risk until you can verify behavior with a canary + real traffic.

Jump to Verify Open PR/Commit
@@ -351,6 +351,54 @@ def encode_result(self, result, state): return task_id in self._cache + def _get_result_meta(self, result, + state, traceback, request, format_date=True, + encode=False):
repro.py
types in document index requests is deprecated, use the typeless endpoints instead (/{index}/_doc/{id}, /{index}/_doc, or /{index}/_create/{id}). warnings.warn(message, category=ElasticsearchDeprecationWarning) [2020-08-18 09:14:06,421: ERROR/MainProcess] Pool callback raised exception: RequestError(400, 'illegal_argument_exception', {'error': {'root_cause': [{'type': 'illegal_argument_exception', 'reason': 'mapper [result.args] of different type, current_type [long], merged_type [text]'}], 'type': 'illegal_argument_exception', 'reason': 'mapper [result.args] of different type, current_type [long], merged_type [text]'}, 'status': 400}) Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/billiard/pool.py", line 1796, in safe_apply_callback fun(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/celery/worker/request.py", line 528, in on_failure store_result=self.store_errors, File "/usr/local/lib/python3.7/site-packages/celery/backends/base.py", line 160, in mark_as_failure traceback=traceback, request=request) File "/usr/local/lib/python3.7/site-packages/celery/backends/base.py", line 407, in store_result request=request, **kwargs) File "/usr/local/lib/python3.7/site-packages/celery/backends/base.py", line 758, in _store_result self.set(self.get_key_for_task(task_id), self.encode(meta)) File "/usr/local/lib/python3.7/site-packages/celery/backends/elasticsearch.py", line 109, in set datetime.utcnow().isoformat()[:-3] File "/usr/local/lib/python3.7/site-packages/celery/backends/elasticsearch.py", line 126, in _index **kwargs File "/usr/local/lib/python3.7/site-packages/elasticsearch/client/utils.py", line 139, in _wrapped return func(*args, params=params, headers=headers, **kwargs) File "/usr/local/lib/python3.7/site-packages/elasticsearch/client/__init__.py", line 380, in index body=body, File "/usr/local/lib/python3.7/site-packages/elasticsearch/transport.py", line 352, in perform_request timeout=timeout, File "/usr/local/lib/python3.7/site-packages/elasticsearch/connection/http_urllib3.py", line 256, in perform_request self._raise_error(response.status, raw_data) File "/usr/local/lib/python3.7/site-packages/elasticsearch/connection/base.py", line 288, in _raise_error status_code, error_message, additional_info elasticsearch.exceptions.RequestError: RequestError(400, 'illegal_argument_exception', 'mapper [result.args] of different type, current_type [long], merged_type [text]')
verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.
fix.md
Option A — Upgrade to fixed release\npip install celery==4.4.0rc5\nWhen NOT to use: Do not apply this fix if using a non-compatible result backend.\n\n

Why This Fix Works in Production

  • Trigger: types in document index requests is deprecated, use the typeless endpoints instead (/{index}/_doc/{id}, /{index}/_doc, or /{index}/_create/{id}).
  • Mechanism: The result backend fails to save properly in Elastic Search due to insufficient result storage functionality
  • Why the fix works: Fixes the issue of the result backend not saving properly in Elastic Search by extending the result storage functionality across all backends. (first fixed release: 4.4.0rc5).
Production impact:
  • If left unfixed, this can cause silent data inconsistencies that propagate (bad cache entries, incorrect downstream decisions).

Why This Breaks in Prod

  • Shows up under Python 3.7 in real deployments (not just unit tests).
  • The result backend fails to save properly in Elastic Search due to insufficient result storage functionality
  • Surfaces as: types in document index requests is deprecated, use the typeless endpoints instead (/{index}/_doc/{id}, /{index}/_doc, or /{index}/_create/{id}).

Proof / Evidence

  • GitHub issue: #6306
  • Fix PR: https://github.com/celery/celery/pull/5661
  • First fixed release: 4.4.0rc5
  • Reproduced locally: No (not executed)
  • Last verified: 2026-02-09
  • Confidence: 0.85
  • Did this fix it?: Yes (upstream fix exists)
  • Own content ratio: 0.29

Discussion

High-signal excerpts from the issue thread (symptoms, repros, edge-cases).

“<!-- Please fill this template entirely and do not erase parts of it. We reserve the right to close without a response bug reports which are incomplete. --> # Checklist <!-- To check an item on the list replace [ ] with [x]. --> - [x] I hav”
Issue thread · issue description · source

Failure Signature (Search String)

  • types in document index requests is deprecated, use the typeless endpoints instead (/{index}/_doc/{id}, /{index}/_doc, or /{index}/_create/{id}).

Error Message

Stack trace
error.txt
Error Message ------------- types in document index requests is deprecated, use the typeless endpoints instead (/{index}/_doc/{id}, /{index}/_doc, or /{index}/_create/{id}). warnings.warn(message, category=ElasticsearchDeprecationWarning) [2020-08-18 09:14:06,421: ERROR/MainProcess] Pool callback raised exception: RequestError(400, 'illegal_argument_exception', {'error': {'root_cause': [{'type': 'illegal_argument_exception', 'reason': 'mapper [result.args] of different type, current_type [long], merged_type [text]'}], 'type': 'illegal_argument_exception', 'reason': 'mapper [result.args] of different type, current_type [long], merged_type [text]'}, 'status': 400}) Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/billiard/pool.py", line 1796, in safe_apply_callback fun(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/celery/worker/request.py", line 528, in on_failure store_result=self.store_errors, File "/usr/local/lib/python3.7/site-packages/celery/backends/base.py", line 160, in mark_as_failure traceback=traceback, request=request) File "/usr/local/lib/python3.7/site-packages/celery/backends/base.py", line 407, in store_result request=request, **kwargs) File "/usr/local/lib/python3.7/site-packages/celery/backends/base.py", line 758, in _store_result self.set(self.get_key_for_task(task_id), self.encode(meta)) File "/usr/local/lib ... (truncated) ...

Minimal Reproduction

repro.py
types in document index requests is deprecated, use the typeless endpoints instead (/{index}/_doc/{id}, /{index}/_doc, or /{index}/_create/{id}). warnings.warn(message, category=ElasticsearchDeprecationWarning) [2020-08-18 09:14:06,421: ERROR/MainProcess] Pool callback raised exception: RequestError(400, 'illegal_argument_exception', {'error': {'root_cause': [{'type': 'illegal_argument_exception', 'reason': 'mapper [result.args] of different type, current_type [long], merged_type [text]'}], 'type': 'illegal_argument_exception', 'reason': 'mapper [result.args] of different type, current_type [long], merged_type [text]'}, 'status': 400}) Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/billiard/pool.py", line 1796, in safe_apply_callback fun(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/celery/worker/request.py", line 528, in on_failure store_result=self.store_errors, File "/usr/local/lib/python3.7/site-packages/celery/backends/base.py", line 160, in mark_as_failure traceback=traceback, request=request) File "/usr/local/lib/python3.7/site-packages/celery/backends/base.py", line 407, in store_result request=request, **kwargs) File "/usr/local/lib/python3.7/site-packages/celery/backends/base.py", line 758, in _store_result self.set(self.get_key_for_task(task_id), self.encode(meta)) File "/usr/local/lib/python3.7/site-packages/celery/backends/elasticsearch.py", line 109, in set datetime.utcnow().isoformat()[:-3] File "/usr/local/lib/python3.7/site-packages/celery/backends/elasticsearch.py", line 126, in _index **kwargs File "/usr/local/lib/python3.7/site-packages/elasticsearch/client/utils.py", line 139, in _wrapped return func(*args, params=params, headers=headers, **kwargs) File "/usr/local/lib/python3.7/site-packages/elasticsearch/client/__init__.py", line 380, in index body=body, File "/usr/local/lib/python3.7/site-packages/elasticsearch/transport.py", line 352, in perform_request timeout=timeout, File "/usr/local/lib/python3.7/site-packages/elasticsearch/connection/http_urllib3.py", line 256, in perform_request self._raise_error(response.status, raw_data) File "/usr/local/lib/python3.7/site-packages/elasticsearch/connection/base.py", line 288, in _raise_error status_code, error_message, additional_info elasticsearch.exceptions.RequestError: RequestError(400, 'illegal_argument_exception', 'mapper [result.args] of different type, current_type [long], merged_type [text]')

Environment

  • Python: 3.7

What Broke

Tasks fail to save results, leading to data loss in production environments.

Why It Broke

The result backend fails to save properly in Elastic Search due to insufficient result storage functionality

Fix Options (Details)

Option A — Upgrade to fixed release Safe default (recommended)

pip install celery==4.4.0rc5

When NOT to use: Do not apply this fix if using a non-compatible result backend.

Use when you can deploy the upstream fix. It is usually lower-risk than long-lived workarounds.

Fix reference: https://github.com/celery/celery/pull/5661

First fixed release: 4.4.0rc5

Last verified: 2026-02-09. Validate in your environment.

Get updates

We publish verified fixes weekly. No spam.

Subscribe

When NOT to Use This Fix

  • Do not apply this fix if using a non-compatible result backend.

Verify Fix

verify
Re-run the minimal reproduction on your broken version, then apply the fix and re-run.

Did This Fix Work in Your Case?

Quick signal helps us prioritize which fixes to verify and improve.

Prevention

  • Make timeouts explicit and test them (unit + integration) to avoid silent behavior changes.
  • Instrument retries (attempt count + reason) and alert on spikes to catch dependency slowdowns.

Version Compatibility Table

VersionStatus
4.4.0rc5 Fixed

Related Issues

No related fixes found.

Sources

We don’t republish the full GitHub discussion text. Use the links above for context.