---
title: "MGS1031: a project's output is another project's source"
description: A file one project declares as an output is claimed by a different project's source glob. Nothing is wrong until the bytes change, and then the write is reported against the project that did not make it.
tags: [MGS1031, magusfile, sources, outputs, generated, doctor]
---

# MGS1031: a project's output is another project's source

One project declares a file as an **output**. A different project's source glob **also**
claims it. Both declarations are individually reasonable, and together they arm a report
that blames the wrong project.

```text
[advice] output-is-another-projects-source: 11 declared output(s) are also another
project's source
    libs/testlayout/MAGUS.md is libs/testlayout's output and .'s source
```

## Why it matters only later

Nothing misbehaves while the file's content is stable. The moment it changes:

1. the owning project's `generate` rewrites it, which is exactly its job
2. the claiming project is running a target that declared the same path as a **source**
3. that target sees a declared input move underneath it and reports
   [MGS4007](../race/MGS4007.md) - an undeclared source mutation

The report is true about the write and wrong about the cause. The file is generated by
definition, and the project named in the message never wrote it.

This is why the check is static. The conflict lives in the declarations, so it can be
answered before anything runs - and it is present for as long as the two globs overlap,
not only on the day some content drifts. In magus's own tree it sat on four projects'
`MAGUS.md` files for as long as the markdown spell has claimed `**/*.md`, and only the
one whose bytes went stale ever surfaced it.

## What to do

Decide which project owns the file, then make the declarations say so:

- **Narrow the claiming glob.** Usually right when the claim is incidental - a broad
  `**/*.md` from a spell sweeping up a nested project's generated index.
- **Move the file** into the owning project's tree, if it is only claimed because of where
  it sits.
- **Leave it, deliberately.** A file genuinely read by one project and written by another
  is a real relationship; declare the dependency so the ordering is explicit rather than
  incidental.

It is **advice, not a failure**, for the reason [MGS1028](MGS1028.md) is: which project
owns a file is the workspace's judgment, and a check that failed on it would be dictating
a layout it cannot see the reasons for.

## Exact paths only

The check compares an **exact** output path against the other project's globs. Whether two
globs can overlap is not decidable in general - the same line
[MGS4002](../race/MGS4002.md) draws - but whether a pattern matches one literal path
is. An output declared as a pattern (`dist/**`) is not reported.
