﻿# Flyte 2 File.download: a local input can return its source path instead of an independent copy

Avoid accidental edits to Flyte 2 local file inputs by distinguishing a downloaded working copy from a returned source path before normalizing model data.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-flyte-two-local-file-download-source-alias/
Language: en

## Normalization changes the original fixture

A task obtains a path from a File input and normalizes its contents in place. In remote testing this looked like editing a downloaded working file. With a local mounted input, the returned path can be the source itself. The test fixture is then modified, affecting later evaluations that expected the original text.

The word download should not be treated as a universal copy guarantee. Establish whether the input is already local and whether the returned path is distinct before using an operation that overwrites or deletes content.

## Read the local-path behavior

The [file and directory guide](https://www.union.ai/docs/v2/flyte/user-guide/tasks/task-programming/files-and-directories/) documents that local File downloads can return the file's own path without copying. It also distinguishes requesting a different local_path when a separate copy is required. Inspect the behavior supported by the installed SDK.

For this normalization task, choose a distinct working path explicitly and preserve the original input identity. A different variable name in Python does not create an independent file; the filesystem paths and actual operation determine ownership.

## Offloaded references and file contents are distinct

The [data location guide](https://www.union.ai/docs/v2/flyte/user-guide/get-started/core-concepts/where-data-lives/) distinguishes stored references from raw data values. A File object can represent access to data without embedding all bytes in the object passed between tasks.

Document which object is an immutable input and which location is a mutable workspace. [Unicode span integrity](/journal/data-guide-unicode-normalization-span-integrity/) makes the consequence concrete: normalization can invalidate offsets in associated labels even when the resulting text appears visually unchanged.

## Execution mode changes the validation context

The [run-mode guide](https://www.union.ai/docs/v2/flyte/user-guide/get-started/run-modes/) distinguishes in-process local execution from container execution. Test the input forms the application actually supports, including mounted local files if they are part of development or deployment.

Do not assume that a successful remote case proves identical copy behavior for an already local source. Conversely, a local aliasing failure does not establish that every remote download shares the source path. Classify the access boundary before generalizing the observation.

## Verify source preservation deliberately

Create a small input with recognizable bytes, perform the transformation through a separate workspace and compare the source before and after. Check that cleanup removes only the working artifact and leaves the input available to another task.

Apply [explicit schema validation](/journal/data-guide-frictionless-table-schema/) to the transformed output separately. Preserving the original file prevents accidental mutation, while schema and semantic checks establish whether the newly produced data is suitable for inference or evaluation.
