﻿# Metaflow IncludeFile: preserve file content instead of passing a laptop-only path

Choose between a path parameter and Metaflow IncludeFile by distinguishing a locator from a captured file value, including text decoding and downstream parsing.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-metaflow-includefile-content-versus-path-parameter/
Language: en

## The path exists only where the flow was launched

A developer passes a local validation-label path as a string parameter. The remote task receives that same string, but the laptop directory does not exist in its container. Parameter transport succeeded; file transport was never specified. Changing the string's spelling cannot create the missing file remotely.

Decide whether the workflow needs a locator to separately managed data or a captured local file value. Both can be legitimate contracts, but they should not be confused when explaining what an evaluation run actually consumed.

## IncludeFile changes the value being preserved

The [FlowSpec reference](https://docs.metaflow.org/api/flowspec) describes IncludeFile as a special parameter that reads a local file and exposes its contents as a read-only artifact through the flow. Consumers receive the captured value rather than an expectation to reopen the launcher's path.

That is useful for a small curated label file or evaluation specification. It does not mean that every external object referenced inside that file is also captured. A manifest containing mutable URLs still has dependencies beyond its own contents.

## Text and binary are different interpretation choices

The same API distinguishes text conversion from byte storage and documents encoding configuration. Choose according to the file format. Treating binary data as text or silently decoding labels differently can change the evaluation input before the model sees it.

After obtaining the captured value, parse it with a deliberate schema. [Explicit JSON Lines schemas](/journal/data-guide-jsonlines-explicit-schema/) explain why successful transport alone does not establish valid examples, required fields or consistent types across records.

## Keep data capture separate from code packaging

The [data loading guide](https://docs.metaflow.org/scaling/data) presents local file inputs as versioned flow data. The [project packaging guide](https://docs.metaflow.org/scaling/dependencies/project-structure) addresses a different problem: which source and asset files are included for remote execution.

Choose the boundary that matches ownership. A helper's static template may belong with code, while a user-selected evaluation file can be an input artifact. Neither decision automatically snapshots the database or model that another reference points to.

## Explain what was evaluated

Record the parsed file's identity and semantic role alongside the metric. A historical path can be useful context, but the content actually used is stronger evidence than the current contents of a developer's similarly named file.

For labels that contain text spans, also preserve [Unicode span integrity](/journal/data-guide-unicode-normalization-span-integrity/). Capturing a file consistently does not prevent later normalization from invalidating offsets. Data capture and interpretation remain distinct responsibilities throughout the evaluation.
