🐛 Bug Report: Execution.fromMap throws Bad state: No element when server doesn't return resourceType (pre-Sites servers
I maintainer di solito rispondono entro 1 giorno
@Aakriti7-giti ci sta già lavorando.
Dal 30/8/2026.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 76/100
Direzione di ricerca
Inizia da lib/src/models/execution.dart e segui il modo in cui Functions.createExecution(), Functions.getExecution() e Functions.listExecutions() costruiscono Execution a partire dalle risposte legacy. Confronta i campi resourceType/resourceId con la precedente forma della risposta functionId; il lavoro è completato quando queste chiamate non generano più eccezioni e continuano a esporre lo stato dell’esecuzione, il corpo della risposta e gli altri dati restituiti.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
👟 Reproduction steps
Since appwrite: 26.0.0, Execution.fromMap (in lib/src/models/execution.dart) parses the resourceType field like this:
resourceType: enums.ExecutionResourceType.values.firstWhere(
(e) => e.value == map['resourceType'],
),
This throws Bad state: No element on any self-hosted Appwrite server that predates the Functions/Sites unification and therefore doesn't send a resourceType field in the execution response — it still returns the older shape with functionId instead of resourceId/resourceType.
Because firstWhere has no orElse, this crashes on every Functions.createExecution() / Functions.getExecution() / Functions.listExecutions() call against such a server, even though the HTTP call itself succeeds (2xx) and the function executes correctly — the data is simply lost because the SDK can't build the Execution model from a valid response.
To Reproduce
- Point the SDK at a self-hosted Appwrite server running a version prior to the Functions/Sites unification (i.e. one that still returns functionId on executions instead of resourceId + resourceType).
- Call Functions.createExecution(...).
- The function executes successfully server-side, but the SDK throws:
Bad state: No element
#0 ListBase.firstWhere (dart:collection/list.dart:132:5)
#1 new Execution.fromMap (package:appwrite/src/models/execution.dart:92:56)
#2 Functions.createExecution (package:appwrite/services/functions.dart:81:29)
Raw response for such an execution (obtained via the REST API directly) looks like:
{
"$id": "...",
"functionId": "test-function-id",
"trigger": "http",
"status": "completed",
"responseStatusCode": 200,
"responseBody": "...",
...
}
Note the absence of resourceId / resourceType.
👍 Expected behavior
The SDK shouldn't hard-crash when the server predates a schema change. At minimum, resourceType should fall back to a sane default (e.g. functions, inferred from the presence of the legacy functionId field) instead of throwing, so callers can still get responseBody/status/etc. Ideally the SDK would also surface a clear version-mismatch error rather than an opaque Bad state: No element.
👎 Actual Behavior
It throw an error
🎲 Appwrite version
Appwrite Cloud
💻 Operating system
Linux
🧱 Your Environment
- appwrite (Dart/Flutter SDK): 26.0.0
- Platform: Flutter, iOS/Android
- Server: self-hosted Appwrite (pre-Sites-unification version)
👀 Have you spent some time to check if this issue has been raised before?
- I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- I have read the Code of Conduct
- Lingua principale
- Twig
- Stelle
- 330
- Fork
- 212
- Merge medio
- 12h 3m
- PR unite (30g)
- 131
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di appwrite/sdk-generator
-
Generate Push by default for SDKs that already released itForse di nuovo libera @ChiragAgg5k l’ha presa 34 giorni fa e non c’è nessuna pull request aperta. Aperta
appwrite/sdk-generator#2043 · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 45/100
appwrite/sdk-generator#1996 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
appwrite/sdk-generator#1851 ·
I maintainer di solito rispondono entro 1 giorno
-
📚 Documentation: Add Vale linting for all generated docs and examplesForse già presa @kekubhai l’ha presa 74 giorni fa. Aperta
appwrite/sdk-generator#1822 · 1 commento · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
Dependency DashboardAperta
Difficoltà 5/5 Più di una settimana Idoneità per principianti 15/100
appwrite/sdk-generator#1628 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di appwrite/sdk-generator
Issue simili
-
HTTP Request Smuggling: non-final chunked Transfer-Encoding not rejected (CWE-444)Forse già presa @code1a2024 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
IBM-Cloud/terraform-provider-ibm#7115 ·
I maintainer di solito rispondono entro 2 giorni
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
hiero-ledger/hiero-sdk-js#4793 ·
I maintainer di solito rispondono entro 1 giorno
-
.NET bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
weaviate/weaviate-python-client#2265 ·
I maintainer di solito rispondono entro 1 giorno