flyteorg / flyteorg/flyte

[BUG] Console crashes with "Cannot destructure property 'type'" when a node execution's inputs don't match the resolved task interface

Open Beginner friendly
#8,038 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
7.5k
Forks
886
Avg merge
1d 14h
Merged PRs (30d)
120

Description

### Describe the bug

Opening an execution's details view in the console can crash the entire page with the error boundary:

```
Unexpected error
TypeError: Cannot destructure property 'type' of 't[a]' as it is undefined.
```

In our case this happens reliably when navigating to a (parent) execution that contains a dynamic node whose children launch child executions: following the **Parent** link from a child execution to that parent execution shows the error page instead of the execution view.

**Root cause**

The only code that can throw this is `literalsToLiteralValueMap` in `packages/oss-console/src/components/Launch/LaunchForm/utils.ts` ([line 236 on v1.20.1](https://github.com/flyteorg/flyteconsole/blob/v1.20.1/packages/oss-console/src/components/Launch/LaunchForm/utils.ts#L236), unchanged on current master):

```ts
for (let i = 0; i < Object.keys(literals).length; i++) {
const name = Object.keys(literals)[i];
const { type } = nameToTypeMap[name]; // ← throws when `name` is not in the map
...
}
```

It iterates over the node execution's **actual input literals** (`fullInputs.literals`) and looks each key up in the **resolved task template's** `interface.inputs.variables`. If the execution data contains any input key that the resolved interface does not declare — e.g. for dynamic-node children where the template resolution can pick a template whose interface doesn't match, or tasks re-registered with a changed signature — the lookup returns `undefined` and the destructure throws.

The callers (`ExecutionDetailsActions/RerunButton.tsx`, `ExecutionDetailsActions/ResumeButton.tsx`, and the table-row equivalents under `Executions/Tables/NodeExecutionActions/`) run this while rendering — in `ExecutionDetailsActions/RerunButton.tsx` the data query is not gated behind the button click, so the exception escapes to the page error boundary and takes down the whole execution view. A mismatched node should at worst degrade the Rerun pre-fill, not make the execution unviewable.

### Expected behavior

The execution details view renders; input keys unknown to the resolved interface are skipped (or the Rerun form falls back to empty initial values). Suggested minimal fix:

```ts
const variable = nameToTypeMap[name];
if (!variable) continue; // don't crash the page on interface mismatch
const { type } = variable;
```

Happy to send a PR for this.

### Additional context to reproduce

1. Have an execution where any node execution's `fullInputs.literals` contains a key not present in the task template interface the console resolves for that node (we hit it via a dynamic node launching child executions; clicking the child's Parent link navigates to the affected parent execution).
2. Open that execution's details page in the console → error boundary with the TypeError above.

### Flyte & Flytekit version

- flyteconsole v1.20.1 (flyte-core Helm chart; flyteadmin/flytepropeller v1.16.4)
- The affected code path is unchanged on flyteconsole `master`.

### Are you sure this issue hasn't been raised already?

- [x] Yes

### Have you read the Code of Conduct?

- [x] Yes

Contributor guide

Open the contributing guide

Research direction

Start in packages/oss-console/src/components/Launch/LaunchForm/utils.ts at literalsToLiteralValueMap, then inspect its callers in ExecutionDetailsActions/RerunButton.tsx, ExecutionDetailsActions/ResumeButton.tsx, and the node execution action tables. Reproduce the mismatched-interface execution from the issue; done means the execution details view renders and unknown input keys no longer crash the page or its Rerun pre-fill.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.