tensorflow/models · error · ValueError
Unknown feature source
Error message
Unknown feature source {self._feature_sources[i]} for {name} What it means
Per-feature validation in the YT8M input parser's __init__: while building tf.io parse specs, feature_sources[i] must be one of the recognized sources — 'feature' (sequence-level, FixedLenSequenceFeature), 'context' (FixedLenFeature), or label sources like 'ids'/'rgb'/'audio'. The value at index i matched none, so the parser cannot decide how to declare that feature in the example spec; the message names the offending source value and feature name.
Solutions
- Set each entry of feature_sources to a supported value: 'feature', 'context', 'ids', 'rgb', or 'audio'
- Align feature_sources, feature_names, feature_sizes, and feature_dtypes element-wise — check for truncation or reordering
- Check for typos like 'features' or 'Context'
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at official/projects/yt8m/dataloaders/yt8m_input.py:303 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of tensorflow/models@e006f5f0d5 (2026-08-24).
Data as JSON: /api/errors/7a00b23abb50c5be.
Report an issue: GitHub.
Appendix: source
Thrown at official/projects/yt8m/dataloaders/yt8m_input.py:303
else:
self._add_labels_specification()
for i, name in enumerate(self._feature_names):
if self._feature_from_bytes[i]:
feature_type = tf.io.FixedLenSequenceFeature([], dtype=tf.string)
else:
dtype = tf.dtypes.as_dtype(self._feature_dtypes[i])
feature_shape = [self._feature_sizes[i]]
if self._feature_sources[i] == "feature":
feature_type = tf.io.FixedLenSequenceFeature(feature_shape, dtype)
else:
feature_type = tf.io.FixedLenFeature(feature_shape, dtype)
if self._feature_sources[i] == "feature":
self._sequence_features[name] = feature_type
elif self._feature_sources[i] == "context":
self._context_features[name] = feature_type
else:
raise ValueError(
f"Unknown feature source {self._feature_sources[i]} for {name}")
def _add_labels_specification(self):
if not self._label_field:
raise ValueError(f"Invalid label field: {self._label_field}!")
self._context_features.update(
{self._label_field: tf.io.VarLenFeature(tf.int64)})
def decode(self,
serialized_example: tf.train.SequenceExample) -> Dict[str, Any]:
"""Parses a single tf.train.SequenceExample into video and label tensors."""
contexts, features = tf.io.parse_single_sequence_example(
serialized_example,
context_features=self._context_features,
sequence_features=self._sequence_features)
decoded_tensor = {**contexts, **features}
for i, name in enumerate(self._feature_names):
# Convert the VarLen feature to dense tensor.View on GitHub (pinned to e006f5f0d5)