<h1 dir="auto">Checklist</h1>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> This has already been asked to the <a href="https://groups.google.com/forum/#!forum/celery-users" rel="nofollow">discussion group</a> first.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have read the relevant section in the<br>
<a href="http://docs.celeryproject.org/en/latest/contributing.html#other-bugs" rel="nofollow">contribution guide</a><br>
on reporting bugs.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/issues?q=is%3Aissue+label%3A%22Issue+Type%3A+Bug+Report%22+-label%3A%22Category%3A+Documentation%22">issues list</a><br>
for similar or identical bug reports.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22PR+Type%3A+Bugfix%22+-label%3A%22Category%3A+Documentation%22">pull requests list</a><br>
for existing proposed fixes.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/commits/master">commit log</a><br>
to find out if the bug was already fixed in the master branch.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included all related issues and possible duplicate issues<br>
in this issue (If there are none, check this box anyway).</li>
</ul>
<h2 dir="auto">Mandatory Debugging Information</h2>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included the output of <code class="notranslate">celery -A proj report</code> in the issue.<br>
(if you are not able to do this, then at least specify the Celery<br>
version affected).</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included the contents of <code class="notranslate">pip freeze</code> in the issue.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included all the versions of all the external dependencies required<br>
to reproduce this bug.</li>
</ul>
<h2 dir="auto">Optional Debugging Information</h2>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one Python version<br>
and/or implementation.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one message broker and/or<br>
result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one version of the message<br>
broker and/or result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one operating system.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one workers pool.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue with autoscaling, retries,<br>
ETA/Countdown &amp; rate limits disabled.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue after downgrading<br>
and/or upgrading Celery and its dependencies.</li>
</ul>
<h2 dir="auto">Related Issues and Possible Duplicates</h2>

<h4 dir="auto">Related Issues</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h4 dir="auto">Possible Duplicates</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h2 dir="auto">Environment &amp; Settings</h2>

<p dir="auto"><strong>Celery version</strong>:</p>

<details>
<summary><b><code class="notranslate">celery report</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="software -&gt; celery:5.1.0 (sun-harmonics) kombu:5.1.0 py:3.9.5
            billiard:3.6.4.0 py-amqp:5.0.6
platform -&gt; system:Linux arch:64bit, ELF
            kernel version:5.10.35-1-lts imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:pyamqp results:couchdb://.....

broker_url: 'amqp://.....
result_backend: 'couchdb://.....
deprecated_settings: None"><pre class="notranslate"><code class="notranslate">software -&gt; celery:5.1.0 (sun-harmonics) kombu:5.1.0 py:3.9.5
            billiard:3.6.4.0 py-amqp:5.0.6
platform -&gt; system:Linux arch:64bit, ELF
            kernel version:5.10.35-1-lts imp:CPython
loader   -&gt; celery.loaders.app.AppLoader
settings -&gt; transport:pyamqp results:couchdb://.....

broker_url: 'amqp://.....
result_backend: 'couchdb://.....
deprecated_settings: None
</code></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Steps to Reproduce</h1>
<h2 dir="auto">Required Dependencies</h2>

<ul dir="auto">
<li><strong>Minimal Python Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Celery Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Kombu Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Broker Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Result Backend Version</strong>: N/A or Unknown</li>
<li><strong>Minimal OS and/or Kernel Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Broker Client Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Result Backend Client Version</strong>: N/A or Unknown</li>
</ul>
<h3 dir="auto">Python Packages</h3>

<details>
<summary><b><code class="notranslate">pip freeze</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="amqp==5.0.6
billiard==3.6.4.0
celery==5.1.0
certifi==2020.12.5
chardet==4.0.0
click==7.1.2
click-didyoumean==0.0.3
click-plugins==1.1.1
click-repl==0.1.6
idna==2.10
kombu==5.1.0
prompt-toolkit==3.0.18
pycouchdb==1.14.1
pygobject==3.26.1
python-apt==1.6.5+ubuntu0.5
pytz==2021.1
requests==2.25.1
six==1.16.0
unattended-upgrades==0.1
urllib3==1.26.4
vine==5.0.0
wcwidth==0.2.5"><pre class="notranslate"><code class="notranslate">amqp==5.0.6
billiard==3.6.4.0
celery==5.1.0
certifi==2020.12.5
chardet==4.0.0
click==7.1.2
click-didyoumean==0.0.3
click-plugins==1.1.1
click-repl==0.1.6
idna==2.10
kombu==5.1.0
prompt-toolkit==3.0.18
pycouchdb==1.14.1
pygobject==3.26.1
python-apt==1.6.5+ubuntu0.5
pytz==2021.1
requests==2.25.1
six==1.16.0
unattended-upgrades==0.1
urllib3==1.26.4
vine==5.0.0
wcwidth==0.2.5
</code></pre></div>
<p dir="auto"></p>
</details>
<h3 dir="auto">Other Dependencies</h3>

<details>
<p dir="auto">
Couchdb v. 3.1.1
</p>
</details>
<h2 dir="auto">Minimally Reproducible Test Case</h2>

<p dir="auto">This is the code example from the getting started guide. RabbotMQ as a broker and couchdb as a backend.</p>
<details>
<p dir="auto">
</p><div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from celery import Celery
app = Celery(&quot;tasks&quot;, broker=&quot;pyamqp://....&quot;, backend=&quot;couchdb://...&quot;)
@app.task
def add(x, y):
    return x + y"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">celery</span> <span class="pl-k">import</span> <span class="pl-v">Celery</span>
<span class="pl-s1">app</span> <span class="pl-c1">=</span> <span class="pl-v">Celery</span>(<span class="pl-s">"tasks"</span>, <span class="pl-s1">broker</span><span class="pl-c1">=</span><span class="pl-s">"pyamqp://...."</span>, <span class="pl-s1">backend</span><span class="pl-c1">=</span><span class="pl-s">"couchdb://..."</span>)
<span class="pl-en">@<span class="pl-s1">app</span>.<span class="pl-s1">task</span></span>
<span class="pl-k">def</span> <span class="pl-en">add</span>(<span class="pl-s1">x</span>, <span class="pl-s1">y</span>):
    <span class="pl-k">return</span> <span class="pl-s1">x</span> <span class="pl-c1">+</span> <span class="pl-s1">y</span></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Expected Behavior</h1>

<p dir="auto">The result is stored in the backend.</p>
<h1 dir="auto">Actual Behavior</h1>

<p dir="auto">The following error message is displayed:</p>
<details>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[2021-05-23 19:34:24,965: ERROR/MainProcess] Pool callback raised exception: TypeError(&quot;a bytes-like object is required, not 'str'&quot;)
Traceback (most recent call last):
  File &quot;/config/.local/lib/python3.9/site-packages/billiard/pool.py&quot;, line 1796, in safe_apply_callback
    fun(*args, **kwargs)
  File &quot;/config/.local/lib/python3.9/site-packages/celery/worker/request.py&quot;, line 567, in on_failure
    self.task.backend.mark_as_failure(
  File &quot;/config/.local/lib/python3.9/site-packages/celery/backends/base.py&quot;, line 171, in mark_as_failure
    self.store_result(task_id, exc, state,
  File &quot;/config/.local/lib/python3.9/site-packages/celery/backends/base.py&quot;, line 477, in store_result
    self._store_result(task_id, result, state, traceback,
  File &quot;/config/.local/lib/python3.9/site-packages/celery/backends/base.py&quot;, line 898, in _store_result
    current_meta = self._get_task_meta_for(task_id)
  File &quot;/config/.local/lib/python3.9/site-packages/celery/backends/base.py&quot;, line 920, in _get_task_meta_for
    meta = self.get(self.get_key_for_task(task_id))
  File &quot;/config/.local/lib/python3.9/site-packages/celery/backends/couchdb.py&quot;, line 79, in get
    return self.connection.get(key)['value']
  File &quot;/config/.local/lib/python3.9/site-packages/pycouchdb/client.py&quot;, line 345, in get
    (resp, result) = self.resource(*_id_to_path(doc_id)).get(params=params)
  File &quot;/config/.local/lib/python3.9/site-packages/pycouchdb/resource.py&quot;, line 52, in __call__
    base_url = utils.urljoin(self.base_url, *path)
  File &quot;/config/.local/lib/python3.9/site-packages/pycouchdb/utils.py&quot;, line 86, in urljoin
    return reduce(_join, path, base)
  File &quot;/config/.local/lib/python3.9/site-packages/pycouchdb/utils.py&quot;, line 55, in _join
    parts = [head.rstrip(URLSPLITTER), tail.lstrip(URLSPLITTER)]
TypeError: a bytes-like object is required, not 'str'"><pre class="notranslate"><code class="notranslate">[2021-05-23 19:34:24,965: ERROR/MainProcess] Pool callback raised exception: TypeError("a bytes-like object is required, not 'str'")
Traceback (most recent call last):
  File "/config/.local/lib/python3.9/site-packages/billiard/pool.py", line 1796, in safe_apply_callback
    fun(*args, **kwargs)
  File "/config/.local/lib/python3.9/site-packages/celery/worker/request.py", line 567, in on_failure
    self.task.backend.mark_as_failure(
  File "/config/.local/lib/python3.9/site-packages/celery/backends/base.py", line 171, in mark_as_failure
    self.store_result(task_id, exc, state,
  File "/config/.local/lib/python3.9/site-packages/celery/backends/base.py", line 477, in store_result
    self._store_result(task_id, result, state, traceback,
  File "/config/.local/lib/python3.9/site-packages/celery/backends/base.py", line 898, in _store_result
    current_meta = self._get_task_meta_for(task_id)
  File "/config/.local/lib/python3.9/site-packages/celery/backends/base.py", line 920, in _get_task_meta_for
    meta = self.get(self.get_key_for_task(task_id))
  File "/config/.local/lib/python3.9/site-packages/celery/backends/couchdb.py", line 79, in get
    return self.connection.get(key)['value']
  File "/config/.local/lib/python3.9/site-packages/pycouchdb/client.py", line 345, in get
    (resp, result) = self.resource(*_id_to_path(doc_id)).get(params=params)
  File "/config/.local/lib/python3.9/site-packages/pycouchdb/resource.py", line 52, in __call__
    base_url = utils.urljoin(self.base_url, *path)
  File "/config/.local/lib/python3.9/site-packages/pycouchdb/utils.py", line 86, in urljoin
    return reduce(_join, path, base)
  File "/config/.local/lib/python3.9/site-packages/pycouchdb/utils.py", line 55, in _join
    parts = [head.rstrip(URLSPLITTER), tail.lstrip(URLSPLITTER)]
TypeError: a bytes-like object is required, not 'str'
</code></pre></div>
<p dir="auto"></p>
</details>
<p dir="auto">It looks like this function </p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/celery/celery/blob/025bad6e93087414b3ddc288060c367d1937774b/celery/backends/couchdb.py#L77">celery/celery/backends/couchdb.py</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 77
      in
      <a data-pjax="true" class="commit-tease-sha" href="/celery/celery/commit/025bad6e93087414b3ddc288060c367d1937774b">025bad6</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L77" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="77"></td>
          <td id="LC77" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">def</span> <span class="pl-en">get</span>(<span class="pl-s1">self</span>, <span class="pl-s1">key</span>): </td>
        </tr>
    </tbody></table>
  </div>
</div>
 is getting a bytes-like object but a string is needed. I enclosed the key in str(). Then it worked.<p></p>
<h1 dir="auto">Checklist</h1>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> This has already been asked to the <a href="https://groups.google.com/forum/#!forum/celery-users" rel="nofollow">discussion group</a> first.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have read the relevant section in the<br>
<a href="http://docs.celeryproject.org/en/latest/contributing.html#other-bugs" rel="nofollow">contribution guide</a><br>
on reporting bugs.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/issues?q=is%3Aissue+label%3A%22Issue+Type%3A+Bug+Report%22+-label%3A%22Category%3A+Documentation%22">issues list</a><br>
for similar or identical bug reports.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/pulls?q=is%3Apr+label%3A%22PR+Type%3A+Bugfix%22+-label%3A%22Category%3A+Documentation%22">pull requests list</a><br>
for existing proposed fixes.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have checked the <a href="https://github.com/celery/celery/commits/master">commit log</a><br>
to find out if the bug was already fixed in the master branch.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included all related issues and possible duplicate issues<br>
in this issue (If there are none, check this box anyway).</li>
</ul>
<h2 dir="auto">Mandatory Debugging Information</h2>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included the output of <code class="notranslate">celery -A proj report</code> in the issue.<br>
(if you are not able to do this, then at least specify the Celery<br>
version affected).</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have verified that the issue exists against the <code class="notranslate">master</code> branch of Celery.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included the contents of <code class="notranslate">pip freeze</code> in the issue.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have included all the versions of all the external dependencies required<br>
to reproduce this bug.</li>
</ul>
<h2 dir="auto">Optional Debugging Information</h2>

<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I have tried reproducing the issue on more than one Python version<br>
and/or implementation.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one message broker and/or<br>
result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one version of the message<br>
broker and/or result backend.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one operating system.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue on more than one workers pool.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue with autoscaling, retries,<br>
ETA/Countdown &amp; rate limits disabled.</li>
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> I have tried reproducing the issue after downgrading<br>
and/or upgrading Celery and its dependencies.</li>
</ul>
<h2 dir="auto">Related Issues and Possible Duplicates</h2>

<h4 dir="auto">Related Issues</h4>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="645573628" data-permission-text="Title is private" data-url="https://github.com/celery/celery/issues/6189" data-hovercard-type="pull_request" data-hovercard-url="/celery/celery/pull/6189/hovercard" href="https://github.com/celery/celery/pull/6189">#6189</a></li>
</ul>
<h4 dir="auto">Possible Duplicates</h4>
<ul dir="auto">
<li>None</li>
</ul>
<h2 dir="auto">Environment &amp; Settings</h2>

<p dir="auto"><strong>Celery version</strong>: 5.0.1 (singularity)</p>

<details>
<summary><b><code class="notranslate">celery report</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="software -&gt; celery:5.0.1 (singularity) kombu:5.0.2 py:3.9.0
            billiard:3.6.3.0 py-amqp:5.0.1
platform -&gt; system:Linux arch:64bit, ELF
            kernel version:5.8.0-26-generic imp:CPython
loader   -&gt; celery.loaders.default.Loader
settings -&gt; transport:amqp results:disabled

deprecated_settings: None
"><pre class="notranslate"><code class="notranslate">software -&gt; celery:5.0.1 (singularity) kombu:5.0.2 py:3.9.0
            billiard:3.6.3.0 py-amqp:5.0.1
platform -&gt; system:Linux arch:64bit, ELF
            kernel version:5.8.0-26-generic imp:CPython
loader   -&gt; celery.loaders.default.Loader
settings -&gt; transport:amqp results:disabled

deprecated_settings: None

</code></pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Steps to Reproduce</h1>
<h2 dir="auto">Required Dependencies</h2>

<ul dir="auto">
<li><strong>Minimal Python Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Celery Version</strong>: 4.x</li>
<li><strong>Minimal Kombu Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Broker Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Result Backend Version</strong>: N/A or Unknown</li>
<li><strong>Minimal OS and/or Kernel Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Broker Client Version</strong>: N/A or Unknown</li>
<li><strong>Minimal Result Backend Client Version</strong>: N/A or Unknown</li>
</ul>
<h3 dir="auto">Python Packages</h3>

<details>
<summary><b><code class="notranslate">pip freeze</code> Output:</b></summary>
<p dir="auto">
</p><div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"><code class="notranslate">
</code></pre></div>
<p dir="auto"></p>
</details>
<h3 dir="auto">Other Dependencies</h3>

<details>
<p dir="auto">
N/A
</p>
</details>
<h2 dir="auto">Minimally Reproducible Test Case</h2>

<details>
<p dir="auto">
</p><div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="from celery import shared_task, chain

@shared_task
def foo(*args):
  return 'foo'

@shared_task(bind=True)
def replace_with_empty_chain():
  self.replace(chain())

chain(foo.s(), replace_with_empty_chain.s()).delay()"><pre class="notranslate"><span class="pl-k">from</span> <span class="pl-s1">celery</span> <span class="pl-k">import</span> <span class="pl-s1">shared_task</span>, <span class="pl-s1">chain</span>

<span class="pl-en">@<span class="pl-s1">shared_task</span></span>
<span class="pl-k">def</span> <span class="pl-en">foo</span>(<span class="pl-c1">*</span><span class="pl-s1">args</span>):
  <span class="pl-k">return</span> <span class="pl-s">'foo'</span>

<span class="pl-en">@<span class="pl-en">shared_task</span>(<span class="pl-s1">bind</span><span class="pl-c1">=</span><span class="pl-c1">True</span>)</span>
<span class="pl-k">def</span> <span class="pl-en">replace_with_empty_chain</span>():
  <span class="pl-s1">self</span>.<span class="pl-en">replace</span>(<span class="pl-en">chain</span>())

<span class="pl-en">chain</span>(<span class="pl-s1">foo</span>.<span class="pl-en">s</span>(), <span class="pl-s1">replace_with_empty_chain</span>.<span class="pl-en">s</span>()).<span class="pl-en">delay</span>()</pre></div>
<p dir="auto"></p>
</details>
<h1 dir="auto">Expected Behavior</h1>

<p dir="auto">A clear error message is raised.</p>
<h1 dir="auto">Actual Behavior</h1>

<p dir="auto">An <code class="notranslate">IndexError</code> is raised with a message that doesn't explain what went wrong.</p>